Docker compose - add startup delay to entrypoint?

Im looking to delay load syncthing docker on my system. I have found I can modify the entrypoint with a sleep, however after adding the sleep the container loading fails…

Any idea how to get this to work with a sleep command?

this works normal:

entrypoint: "./bin/ /bin/syncthing"

this fails:

entrypoint: "sleep 1 && ./bin/ /bin/syncthing"

docker compose:

version: '3.7'

    image: syncthing/syncthing
    container_name: syncthing
        - PUID=1000
        - PGID=1000
        #- STGUIADDRESS=
       # STHOMEDIR=/home
    restart: unless-stopped
    network_mode: host
    entrypoint: "sleep 1 && ./bin/ /bin/syncthing"
        - ${HOME}/Docker/syncthing/config:/var/syncthing/config
        - /etc/localtime:/etc/localtime:ro

Why do you need to delay the startup?

The entrypoint is not evaluated by any shell, hence your command does not work. You can work around this by changing it to something like:

entrypoint: “bash -c ‘sleep 1 && ./bin/ /bin/syncthing’”

Great! I ended up with the following command:

entrypoint: sh -c 'sleep 10  && /bin/ /bin/syncthing'

I need a delay to allow the os to finish booting and connect to the usb disk drives.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.