skip to Main Content

Tks all, idk why, but now its working

I learn to use docker. I try 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 imageID **
I tried in another disk and tried many ways but still not working. Can u help me ?

2

Answers


  1. 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:Usersuserwork:/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

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search