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

Bind Mounts on windows not working #100

Closed
Nyerca opened this issue Oct 27, 2020 · 10 comments
Closed

Bind Mounts on windows not working #100

Nyerca opened this issue Oct 27, 2020 · 10 comments

Comments

@Nyerca
Copy link

Nyerca commented Oct 27, 2020

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

@diligent176
Copy link

Nice! This helped me complete the tutorial on Windows 10.
Thanks for the tip, this worked for me:

docker run -dp 3000:3000 -w /app -v "//c/github/todo-nodeapp:/app" node:12-alpine sh -c "yarn install && yarn run dev"

@AfroBadger
Copy link

AfroBadger commented Jan 27, 2021

Glad I found this thread. I too have the same problem. Not sure if it is something new with WSL2.

Docker did first accept the new command syntax //drive/appdir:/app , but now it is responding the same way as before with the container exiting. Any way I can see what error is causing the container to exit?

@Franz333
Copy link

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

@mcarson1
Copy link

mcarson1 commented May 4, 2021

I had to be in the right directory (where I downloaded and unzipped the app).

@Emprah
Copy link

Emprah commented 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

@confessore
Copy link

confirmed.
before running this command navigate to the "app" directory that came with "getting-started"

since "${PWD}" is basically the command to get the current directory path, you need to be inside of the proper directory to the correct path to run the command!

@kaiimran
Copy link

Hopefully they will update the docs this year. #184

@dustan22
Copy link

Glad I found this thread. I too have the same problem. Not sure if it is something new with WSL2.

Docker did first accept the new command syntax //drive/appdir:/app , but now it is responding the same way as before with the container exiting. Any way I can see what error is causing the container to exit?

If you use the docker desktop app, you can click on the container name and it will try to create the container and show you any errors.

@mikesir87
Copy link
Member

Hi all! Apologies for the delay in responding to this issue. The tutorial has gone through several improvements since this issue was created, some of which I anticipate would have resolved this issue. In addition, there are a few answers that have been posted here already. Therefore, I'm going to go ahead and close it.

If you have future questions or issues, feel free to create a new issue and we'll be happy to help out (and will respond much more quickly too!). Thanks all!

@RandyBetancourt
Copy link

I know this closed, but for others after me--the issue I ran into was
The engine "node" is incompatible with this module. Expected version "^14.15.0 || ^16.10.0 || >=18.0.0". Got "12.22.12"
I got around it by adding the --ignore-engines arg:
PS> docker run -dp 3000:3000 -v "$(pwd):/app/" node:12-alpine sh -c "cd app && yarn install --ignore-engines && yarn run dev"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests