kell
kell

Reputation: 81

Docker: error while creating mount source path. How can i fix it?

Tks all, idk why, but now its working

I am learning to use docker. I am trying to mount a host directory in a Docker container:

>docker run -it -v /Users/Kell/Desktop/data:/home/data 77

And this is error: docker:

Error response from daemon: error while creating mount source path '/Users/Kell/Desktop/data': mkdir /Users: file exists.

I use Windows and Docker 20.10.12, 77 is the imageID I tried on another disk and tried many other ways but it is still not working. Can you help me?

Upvotes: 7

Views: 51368

Answers (2)

Ralf
Ralf

Reputation: 1108

If you installed Docker with snap e.g. during installing Ubuntu, you may have a pathing issue. In that case, Docker cannot write to your path. Try a path in /home directory. Something like /home/docker/. https://stackoverflow.com/a/63489929/425024

Upvotes: 4

araisch
araisch

Reputation: 1940

If you learning docker from scratch it is recommended to use --mount and not -v anymore: Mount > v

The syntax of --mount and -v differs, so here you' find both: How to mount

Path style in Windows depends on the console you are using. Some are just working in one and not in another.

Windows-Style: docker run --rm -ti -v C:\Users\user\work:/work alpine

Pseudo-Linux-Style in Windows: docker run --rm -ti -v /c/Users/user/work:/work alpine as well as //c/

Inside WSL: docker run --rm -ti -v /mnt/c/Users/user/work:/work alpine

See: Path conversion in Windows

Upvotes: 5

Related Questions