Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Named Volume and Shared Volume (windows) -- permissons & git-bash #43

Open
teebu opened this issue May 28, 2020 · 2 comments
Open

Named Volume and Shared Volume (windows) -- permissons & git-bash #43

teebu opened this issue May 28, 2020 · 2 comments

Comments

@teebu
Copy link

@teebu teebu commented May 28, 2020

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:

image

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"
@StefanScherer
Copy link
Member

@StefanScherer StefanScherer commented Jul 15, 2020

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

@StefanScherer
Copy link
Member

@StefanScherer StefanScherer commented Jul 15, 2020

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 ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.