getting-started
getting-started copied to clipboard
Named Volume and Shared Volume (windows) -- permissons & git-bash
page: tutorial/using-bind-mounts/
Running Docker Desktop 2.3.0.3 on Windows has a security feature that requires folder permissions, otherwise it will throw errors.
Named volume seems you don't need permission (not sure where that file is, somewhere inside some docker VM?)
For shared volume, you need to add path.
Add them in the settings:

When running the commands in git-bash, you have to add //path/ otherwise it will throw errors.
docker run --name todo -dp 3000:3000 --rm \
-w //app/ -v /${PWD}:/app \
-v todo-db:/etc/todos \
node:12-alpine sh -c "yarn install && yarn run dev"
Running in powershell, its fine.
docker run --name todo -dp 3000:3000 `
--rm `
-w /app `
-v ${PWD}:/app `
-v todo-db:/etc/todos `
node:12-alpine `
sh -c "yarn install && yarn run dev"
Thanks @teebu,
That is correct, Git bash needs the extra slashes, because the bash.exe "fixes" the pathes before calling docker.exe.
I've tested it and investigated with Process Monitor how the docker.exe is called.
C:\ProgramData\DockerDesktop\version-bin\docker.exe run -dp 3000:3000 -w "C:/Program Files/Git/app" -v "C:\Users\Stefan Scherer\code\app\app;C:\Program Files\Git\app" node:12-alpine sh -c "yarn install && yarn run dev"
I recommend to use a real bash in WSL 2 :-)
There is a simple workaround that doesn't require a change of the command.
You have to set the environment variable MSYS_NO_PATHCONV=1 to turn off the automatic path conversion of Git bash.
MSYS_NO_PATHCONV=1 docker run ...
Hopefully they will update the docs this year. #184