question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bind Mounts on windows not working

See original GitHub issue

I’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:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:9

github_iconTop GitHub Comments

4reactions
Emprahcommented, May 6, 2021

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:

  • Using Powershell (instead of git bash), to avoid escaping problems
  • Directly going into the app directory instead of using the -w parameter (docker complaining about my path not being an absolute path and whatnot)
  • Adding "cd app"as the first shell command
1reaction
Franz333commented, Feb 12, 2021

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 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

'docker -v' bind mount is not working any more on Windows ...
Now when I run the above interactive command, the /app directory is created in the container, but doesn't have the files from my...
Read more >
2.3.0.2 Broken Bind mounts - Docker Desktop for Windows
It would appear that Docker 2.3.0.2 has issues with bind mounts on windows, I, and others, downgraded to 2.2.0.5 to resolve the issue....
Read more >
Docker: Fix Invalid Bind Mount Spec in Git Bash
The call to docker run using Git Bash on Windows was recently frustrating me when I tried to specify a volume using -v...
Read more >
Bind mounts - Amazon Elastic Container Service
After all of the containers that use a bind mount are stopped, ... Windows containers can mount whole directories on the same drive...
Read more >
Persistent Storage in Containers
Bind mounting directly on cluster shared volumes (CSV) is not supported, ... The identity of the process running in the container ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found