Docker-Compose Startup Delay

Hi,

I am building a small FTP device for file storage which uses NODE.JS to control and OLED screen and a small FTP server. These all work fine, but I want the FTP server to start-up AFTER the OLED screen and monitor and I am struggling to get this to work.

This my compose file:

version: '2'
volumes: 
    resin-data:
services:
  boxBoot:
    build: ./box-boot
    privileged: true 
    restart: no
    network_mode: host
    labels: 
      io.balena.features.supervisor-api: '1'
  boxFTP:
    build: ./box-ftp
    depends_on: 
      - "boxBoot"
    command: ["sleep 5"]
    privileged: false
    restart: always
    network_mode: host
    expose:
      - "21"
    volumes:
      - 'resin-data:/data'
    labels: 
      io.balena.features.supervisor-api: '1'

The problem is that the SLEEP command can not be found, and I don’t know how to introduce a delay. The boxBoot is not a server, it is simply a service monitor with an OLED screen showing output. I use two separate containers, because I will be adding more dockers with more services. This is just an example of a two docker process.

Has anyone had any luck in delaying the startup of a second service? Help much appreciated.

Hello,
The command key of a docker-compose file overrides the command of the container, it is not “prepended”: https://docs.docker.com/compose/compose-file/#command
You need to update the Dockerfile in the box-ftp folder and change the CMD or ENTRYPOINT here to point to a shell script that will sleep 5 then run the command it is supposed to run.
If sleep is not available, you need to install it in the Dockerfile. On debian it is in the coreutils package for example.