Can I Start a Docker Container Without an Available Bind Mount?

0
0
Asked By TechyTurtle89 On

I'm facing an issue with my setup where most of my data is stored on a NAS while my Docker containers run on a different server in the same LAN. I've mounted an SMB share from the NAS on the Docker host, and it works great for containers that need access to that data, like photos and media. However, the problem arises when the NAS isn't available during container startup, which causes the Docker containers to fail to start. Since my NAS isn't online 24/7 but my Docker server is, I'm looking for a way to have the containers start even when the SMB share is offline, and then automount the share when it becomes available—similar to how the x-systemd.automount works in Linux for SMB mounts. Any advice? Thanks!

4 Answers

Answered By CuriousDeveloper77 On

I’m not sure why you’d want to start the container without the NAS available. If the container relies on the mounted share, you might end up with inconsistent data. If the mount isn’t available but the container starts, what behavior would you expect?

Answered By CloudySky42 On

You could write a bash script that checks the availability of the mount point at regular intervals. This script could manage starting different sets of containers based on whether the share is accessible or not. Unfortunately, Docker itself doesn’t handle this situation automatically, so a workaround like this is needed.

Answered By TechyTurtle89 On
Answered By DataNerd23 On

Nope, Docker requires the mounts to exist when the container starts. If the shared resource isn’t available, the container won’t launch.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.