I originally asked this on Stack Overflow, but I thought Super User might be more appropriate.
I have the strangest situation using Docker on WSL (Windows Subsystem for Linux, Ubuntu 16.04). I'm trying to bind mount
/home/username (or just
$HOME for convenience) as a volume in a container, and instead of finding the content of my home directory in the container, I get some other volume entirely.
What's stranger is that this 'other volume' persists from one container to the other whenever I try to bind mount
/home/username. If I touch a new file, it appears in all other containers I mount
$HOME into. All other bind mounts to any other directory work correctly.
E.g. these all share the same mystery folder:
docker run -it --rm -v /home/username:/test alpine sh docker run -it --rm -v $HOME:/test alpine sh docker run -it --rm -v $HOME:/test -v $HOME:/test2 alpine sh
When I do a
docker volume ls there's no volume called
/home/username, so that rules out accidentally having a docker-hosted volume with the same name.
What is this mysterious volume I'm mounting, and why is docker not mounting my
$HOME directory correctly?