Skip to content

Instantly share code, notes, and snippets.

@tehniemer
tehniemer / CIFS_mount_Docker.md
Created August 31, 2021 20:44 — forked from sbrants/CIFS_mount_Docker.md
Mounting shared drives before starting containers when booting the OS.

I had trouble running containers automatically after booting.

The data volumes are mapped to mounted shared drives and this works as expected when starting the comtainers manually with docker-compose up. I've setup the restart: always policy in my docker-compose.yml so containers would be started after I reboot the OS. This resulted in the container not seing the content of the shared drives. The issue is that the containers would start before the drives were mounted.

To fix the issue I added a dependency on the docker daemon service so it would start after the shares are mounted.

First, create a systemd drop-in directory for the docker service: