0

I am trying to execute the following docker command in PowerShell but I cannot get it to recognize the $(PWD) for the current directory. Help please.

docker run -it -v $(PWD):/app --workdir /app samgentile\aspnetcore

I get:

C:\Program Files\Docker\Docker\Resources\bin\docker.exe: invalid reference format.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.
michalhosna
  • 7,327
  • 3
  • 21
  • 40
user2471435
  • 1,644
  • 7
  • 35
  • 62

2 Answers2

3

You should use "/" instead of "\" in the image name:

docker run -it -v $PWD:/app --workdir /app samgentile/aspnetcore
Mihai
  • 9,526
  • 2
  • 18
  • 40
0

Mihai is correct to point out the parentheses. These signify that you want to run the command PWD and use its output, whereas without the parentheses PWD is considered a variable. A correct invocation would take the form:

docker run -it -v $(pwd):/app --workdir /app samgentile/aspnetcore

Or:

docker run -it -v $PWD:/app --workdir /app samgentile/aspnetcore
CameronNemo
  • 616
  • 3
  • 10
  • 1
    This is not really an answer, it's more like a comment. See See stackoverflow.com/help/how-to-answer – michalhosna May 14 '19 at 17:54
  • 1
    @michalhosna well the question isn't really a question its more like demand – CameronNemo May 14 '19 at 18:47
  • 1
    @CameronNemo If you don't like the question, then you shouldn't be answering it. You can always comment, flag, and all of that. But answering to question, you don't think is good, isn't the best way. Don't get me wrong, answering is the most important thing on SO, but quantity is not enough without quality. – michalhosna May 14 '19 at 18:57