Error in Poweshell on docker run -it mount --mount type=bind,src="$(pwd)"

Hi, in the guides, there is a command

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

which gives me an error, if I run it in the Powershell in W11:

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

What is wrong there?

Update: I have tried also with ${pwd}, but with the same result.

Hello! Quoting is wrong in the command.

Try this:

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

Or more explicit (for PowerShell syntax)

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

1 Like

Perfect, this works! Thanks a lot! Maybe somebody should fix the tutorial for PowerShell.

1 Like