Docker Community Forums

Share and learn in the Docker community.

"bind source path does not exist" when creating bind mount from within a container

Using docker for windows with WSL2 I have mounted the docker socket to a container running the docker image:

docker run -ti -v /var/run/docker.sock:/var/run/docker.sock docker

In this container I try to run another container (doesn’t matter which container) and bind mount a file from the windows host machine to the 2nd new container:

docker run --mount type=bind,src=/C/Users/…/test.yml,dst=/test.yml docker

I get the following error:

docker: Error response from daemon: invalid mount config for type “bind”: bind source path does not exist: /C/Users/…/test.yml.

Yes the path does exist, running the 2nd command directly from the host windows machine works
I am using WSL2, with Hyper-V it worked but only after doing a docker login from inside the container.

  • Windows Version: 10.0.19041
  • Docker Desktop Version: 2.3.0.4

This issue is similar but the solution they talk about doesn’t work on WSL2: https://github.com/docker/for-win/issues/6628

Does anyone else have this issue or know why it could be happening?
Has anyone encounter