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

Two commands with pwd variable does not work for Windows users (PowerShell) in 06_bind_mounts.md #17370

Closed
1 task done
hotenov opened this issue May 19, 2023 · 4 comments · Fixed by #17369
Closed
1 task done
Labels
area/get-started Relates to get started and onboarding docs lifecycle/locked

Comments

@hotenov
Copy link
Contributor

hotenov commented May 19, 2023

Is this a docs issue?

  • My issue is about the documentation content or website

Type of issue

Information is incorrect

Description

Current version of command does not work on Windows (PowerShell)

docker run -it --mount type=bind,src="$(pwd)",target=/src ubuntu bash

on page https://docs.docker.com/get-started/06_bind_mounts/#trying-out-bind-mounts

and this

docker run -dp 3000:3000 `
    -w /app --mount type=bind,src="$(pwd)",target=/app `
    node:18-alpine `
    sh -c "yarn install && yarn run dev"

in section https://docs.docker.com/get-started/06_bind_mounts/#run-your-app-in-a-development-container

error in PowerShell shell

invalid argument "type=bind,src=\"$(pwd)\",target=/src" for "--mount" flag: parse error on line 1, column 15: bare " in non-quoted-field

Need to add caveat (note) for Windows users, that they should try this:

docker run -it --mount "type=bind,src=$pwd,target=/src" ubuntu bash

ATTENTION: This command does NOT work in bash shell (Linux).

Location

https://docs.docker.com/get-started/06_bind_mounts/#trying-out-bind-mounts

Suggestion

I opened the PR #17369 (by clicking "Edit this page" link)
but I was in a hurry 🤨and forgot about Linux users.

Then I noticed that there is a similar command below with separation onto Linux and Windows users. I copied this style for section above and also corrected the PowerShell command in the second place.

@hotenov hotenov added the status/triage Needs triage label May 19, 2023
@hotenov hotenov changed the title Command with pwd variable does not work for Windows users (PowerShell) in 06_bind_mounts.md Two commands with pwd variable does not work for Windows users (PowerShell) in 06_bind_mounts.md May 19, 2023
@craig-osterhout craig-osterhout added area/get-started Relates to get started and onboarding docs and removed status/triage Needs triage labels May 19, 2023
@craig-osterhout
Copy link
Contributor

Thanks for sharing the issue. I'm trying to reproduce this error, and I can't do it with the current command.

The only way I can reproduce it is by modifying the command as the following:

PS C:\Users\Craig Osterhout> docker run -dp 3000:3000 `
>>        -w /app --mount 'type=bind,src=\"$(pwd)\",target=/app' `
>>        node:18-alpine `
>>        sh -c "yarn install && yarn run dev"
invalid argument "type=bind,src=\"$(pwd)\",target=/app" for "--mount" flag: parse error on line 1, column 15: bare " in non-quoted-field

image

If possible, can you help share a screenshot like the above, so that we get more details.

@craig-osterhout craig-osterhout added the status/need-more-info Need more information about the issue/PR label May 19, 2023
@hotenov
Copy link
Contributor Author

hotenov commented May 19, 2023

@craig-osterhout Hi! Sure!

Issue is reproduced for modern PowerShell 7. I forgot to check in PowerShell 5.1 :) Yes, with 5.1 there is no this issue.

image

BTW, my code for version 7 also works for 5.1 😀So, it's up to you which version you are targeting. But I think many users use PS7 already. At least, two of us :) -> https://forums.docker.com/t/error-in-poweshell-on-docker-run-it-mount-mount-type-bind-src-pwd/136051

@craig-osterhout
Copy link
Contributor

Thank you @hotenov.

@craig-osterhout craig-osterhout removed the status/need-more-info Need more information about the issue/PR label May 19, 2023
@docker-robot
Copy link

docker-robot bot commented Jun 18, 2023

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

/lifecycle locked

@docker-robot docker-robot bot locked and limited conversation to collaborators Jun 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/get-started Relates to get started and onboarding docs lifecycle/locked
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants