So I recently moved most of my docker storage to a second hard drive, called “storage.” After a system restart, docker is creating a folder called “storage,” forcing the physical drive to be renamed “storage1.” How do I prevent this from happening?

I am using Xubuntu.


Edit: As suggested, it was indeed my system spinning up Docker before mounting the internal disk. The solution (should work on most Unix-like systems) was to manually add a line to /etc/fstab as follows: First get the UUID for the problem drive

~$ sudo blkid -s UUID

The output will show your drives and the UUID of each. Then edit the following file:

~$ sudo mousepad /etc/fstab #{or use your choice of editor, i.e. nano}

Add the following line:

/dev/disk/by-uuid/{UUID number copied from blkid output} /destination/of/your/drive ext4 defaults 0 0

Of course replace {UUID number copied from blkid output} and /destination/of/your/drive and set defaults & parameters as needed. These worked for me.

Restart the system and the drive should be forced to mount before docker starts. This seems to be a known issue with certain docker setups.

  • @gedaliyah@lemmy.worldOP
    link
    fedilink
    English
    12 days ago

    I believe that’s exactly what is happening. I just don’t know how to fix it. I could edit the YML files and delete restart: unless-stopped but I want my containers to restart if something goes down unexpectedly

    • @i_stole_ur_taco@lemmy.ca
      link
      fedilink
      English
      12 days ago

      So is the issue that your extra drive mounts to /storage, but that happens after Docker has already started and taken over the directory, so the mount fails? Normally I’d expect it to happen in the other order. Is this a weird race condition?

      This might be a good thing to run through with ChatGPT- there are probably ways to delay the Docker container start, but maybe there’s a more significant misconfiguration you can deal with.