Bind Mounts on windows not working
See original GitHub issueI’m trying to understand why i cant execute this command, i’m currently inside getting-started\app (on Windows) and i get errors:
docker run -dp 3000:3000 \ -w /app -v "$(pwd):/app" \ node:12-alpine \ sh -c "yarn install && yarn run dev"
This opens a message saying docker wants to access: C:\PATH\getting-started\app;C (with the weird ;C at the end)
If i change the code in this way it goes away: -w //app -v “$(pwd)😕/app” \
it starts a container which gets closed immediatly with an error: error Couldn’t find a package.json file in “/app”
I don’t understand why, is the dockerfile or the package.json missplaced? I tried to look at other similar issues on github but i was unable to solve my problem.
Thank you!
UPDATE: Asked a friend, seems like there is a problem with paths that has to be written not in windows style: So from getting-started/app i did:
docker run -dp 3000:3000
-w //app -v “//c/Users/blabla/app_test/getting-started”:/app
node:12-alpine
sh -c “yarn install && yarn run dev”
note the -v has the <host directory>:<target directory> in which the host directory is written in a Linux format
note: if in the -w i would put only: -w /app it would trigger an error: docker: Error response from daemon: the working directory ‘C:/Program Files/Git/app’ is invalid, it needs to be an absolute path. (With the weird git path)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9
Top GitHub Comments
For me, this worked:
PS C:\...\getting-started\app> docker run -dp 3000:3000 -v "$(pwd):/app/" node:12-alpine sh -c "cd app && yarn install && yarn run dev"
The important bits were:
Awsome… thanks a lot… was stuck all day on this… It’s annoying… your are following a tutorial and you get more focused trying to solve the problems than actually learning 😦