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:
-vFailtoMount

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

Hello
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:

docker-win-drives

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.