Docker Community Forums

Share and learn in the Docker community.

Fail to mount a volume to container?

I installed DockerDesktop to WIN10 and Ubuntu1804 from Store.
But when I run docker run -it -v pwd:/build ubuntu bash
I cannot see my host volume in the /build, please see below picture:

Anyone know how to fix this issue ? Any clue is appreciate.

map absolute path with volume,
That’s Work From My understanding.

@rrpnarola thanks for the reply. I tried absolute path, WIN10 driver C is OK, but ubuntu path is still not working, as below:

Any further suggestion ?

Hello In dockerfile Whats You build Can you please share me

a) A command that works everywhere (in PowerShell too) is ... -v "$(pwd):/build" ...
b) Only paths under /c/… are mounted to the Docker VM and can be mounted to a container. Click on ‘Settings’ on the Docker symbol in the taskbar and go to Resources–FILE SHARING to see which drives are available.
(I assume you installed the stable version and not a tech preview.)

1 Like

Thank you all.
@rrpnarola san, the container image “ubuntu” is pull from dock hub, I didn’t change anything yet.
@tekki san, please see below picture, it still cannot mount linux host volume.

Try to Use absolute path For the volume

That’s, as I said in b), because you try to mount a folder under /home. ‘build’ should be placed somewhere in /c.
That’s how it looks in my WSL Debian:

$ mount
C:\ on /c type drvfs (rw,noatime,uid=1000,gid=1000,metadata,case=off)
E:\ on /e type drvfs (rw,noatime,uid=1000,gid=1000,metadata,case=off)

C: and E: are the Windows drives mounted into WSL. My Docker settings are the following:


C: and E: are connected from Windows to the Docker VM and everything inside them can be mounted into a container. From WSL only paths starting with /c and /e are available to Docker.

@rrpnarola san and @tekki san, thank you very much. I can understand now.

Thank you again.