docker-compose volumes not mounting to host directories
Just want to add that if you're developing on Windows, you should explicitly allow Docker to access your C: drive. Until you do that, any mapped volumes will appear as empty.
If running via Hyper-V (Docker for Windows):
- Go to Settings -> Shared Drives, check "C:" (source)
If running via VirtualBox:
VBoxManage sharedfolder add default --name c --hostpath /c --automount
(source)
The problem was that I'd mounted a EBS volume to /volume
after the Docker service had been started.
The directory was mounted in the container, which is why the docker inspect
looks correct, but it mounted the pre-existing mount point which was overlayed by the host's own mount.
This mount happened after the Docker service was started, but long before any containers were actually started up, so it didn't occur to me that Docker might not be respecting the filesystem change which had happened earlier.
The solution was just to restart the Docker service.