Start Storj Docker Container with delay

Hello,

is there a way to start the docker container for storj with a delay? Everytime I restart my Odroid HC2 (sometimes it seem to randomly reboot by itself), some containers beeing started and some not, it’s different on every startup (sometimes all are starting, sometimes just a few), so I think it’s maybe a bit too much for the Odroid to handle at once on boot. So I thought maybe it’s possible to give some containers a delayed start to prevent this? I hope you can help me out :slight_smile:

You need to have a restart policy for your containers, i.e. --restart always or --restart unless-stopped.
You may try to add this option to your docker run command (before the image name):

 --health-start-period duration   Start period for the container to
                                       initialize before starting
1 Like

faced same issue some time ago, and root case for it was hdd is not mounted when docker tries to launch container with storj.
resolved this by adding delay:
sudo systemctl edit docker.service
And paste this lines there:
[Service]
ExecStartPre=/bin/sleep 30

Other way is to wait until mounting point will be mounted for sure:
sudo systemctl edit docker.service
and then add this lines:
[Service]
RequiresMountsFor=/mnt/storj

As for me, i left option 1 with delay 60 seconds

2 Likes

is there a way to manually add a delay for each container, so they start for example one by one every “x” seconds?

Sorry, never interested in, so idk.

I doubt there is such option in the docker itself, but you may use a docker-compose.yml and make each container a service and add dependency, i.e.

Use depends_on: in each next service to be depended on a previous one

Alternative, and in my opinion, much cleaner (and more lightweight) way to run storagenode is to drop docker altogether in favor of podman.

Storagenode can run rootless, so you don’t need to have heavy service like docker running in the background. Configuration is much easier ans well, as podman generates service description files for each container automatically for you.

You could then modify them accordingly, for example, adding dependency, as suggested above:

Moreover, you won’t need watchtower either as podman can auto update containers on timer, also very minimal configuration.

Shameless plug on how to setup docker containers to run on Linux with podman rootless, using UptimeKuma and UniFi controller as examples is here. Once you try that — you would not want to go back to docker :slight_smile: