Can I Mount Subdirectories Inside Docker Volumes on Windows?

0
29
Asked By CreativeLeaf42 On

I'm trying to set up my storage structure using Docker on my Windows machine. I have three drives labeled a:, b:, and c:. My plan is to use drive a: for main files, so I've set it up to include - a::/main. Then, I want to create directories for drives b: and c: inside a: to help organize my files better, like this: - b::/main/b and - c::/main/c. However, whenever I reboot Docker Desktop, I run into issues with errors about already mounted directories unless I manually delete the empty folder that gets created. Is there a better way to achieve this that I'm missing?

4 Answers

Answered By TechieTurtle99 On

When using WSL, remember that all your drives are typically mounted under /mnt/, like /mnt/c. You could bind your folder like this: /mnt/c/some/folder:/path/in/container. Just a heads up though, this method can be quite slow and it’s not the most recommended way for Docker usage.

Answered By DockerDude45 On

Is your container running on Linux? The drive labels you're using look like they're from Windows. You can definitely mount volumes inside other mounted volumes, just make sure they get mounted in the right order. Try using the Docker command line in WSL; it gives a clearer view of what's happening and you can utilize scripts to manage your setup better!

Answered By FolderMaster3000 On

Have you thought about creating the entire folder structure outside of Docker, in Windows, and then just using that single folder as your mount point? Windows actually allows you to mount disks to a folder, which might simplify your setup!

ResourcefulNerd77 -

Here's a guide on how to do it: https://learn.microsoft.com/en-us/windows-server/storage/disk-management/assign-a-mount-point-folder-path-to-a-drive?tabs=disk-management

Answered By ConfusedLlama88 On

I see your concern about files from b: and c: accidentally mixing with a:. Instead of nesting them under a:, you could try using /main/a with separate folders for b and c to keep things organized without conflicts.

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.