Delay portainer or container start

Hi there. Using portainer on coreelec which is a JEOS. Works like a charm.

I am trying to get plex docker managed within portainer to use nfs mounted network shares. The coreelec system uses autostart (not systemd or fstab) to mount the shares at startup.

However docker / portainer / plex container seems to start before the mount happens and as a result while i am able to access the mounts from the OS, plex cant. If i restart docker the mounts show up fine.

What is the easiest way to resolve this ?

Hi extremeaudio,

I think u can delay startup docker with adding some line ExecStartPre=/bin/sleep 30 on docker.service, example

[Service]
Type=notify
ExecStartPre=/bin/sleep 30
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always

that will delay your service 30 sec.

Just make sure the precision of time before your nfs mounted and change the time as you wish.

1 Like

Hey thanks a lot. Will try this and report back. Cheers.

Nope, that didn’t work.

Hi @extremeaudio ,

I found interesting article and i think it has the same problem like you,

edit /etc/systemd/system/multi-user.target.wants/docker.service file.
add mnt-nas.mount in multiple locations in order to make sure that Docker will wait until the mount had completed before starting.

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
BindsTo=containerd.service
After=network-online.target firewalld.service containerd.service mnt-nas.mount
Wants=network-online.target  mnt-nas.mount
Requires=docker.socket  mnt-nas.mount

If you are not certain of the mount name, you can use the following command to list the ones on your system.

systemctl list-units | grep /mnt/

hope this can resolve your problem.