Docker beta for Windows and Windows Bash: path must be absolute

Expected behavior

Mount volume and working directory

Actual behavior

returns error “path must be absolute”

Information

When I try to run Docker container using windows bash, I’ve got this error: path must be absolute, but using Power Shell everything works fine.

Is this a bug or I’m doing it wrong??

Steps to reproduce the behavior

Try to run container using windows bash or git bash for windows

  1. docker run -d --name myapp -p 80:3000 -v "$(pwd):/usr/app" -w "/usr/app" node npm start
  2. docker run -d --name myapp -p 80:3000 -v "/d/projects/docker/myapp:/usr/app" -w "/usr/app" node npm start
  3. docker run -d --name myapp -p 80:3000 -v "/d/projects/docker/myapp:/c/program files/git/usr/app" -w "/usr/app" node npm start
  4. docker run -d --name myapp -p 80:3000 -v "D:/projects/docker/myapp:/usr/app" -w "/usr/app" node npm start
  5. docker run -d --name myapp -p 80:3000 -v "D:/projects/docker/myapp:/usr/app" -w "C:/Program Files/Git/usr/app" node npm start

I think this is part of a class of known problems with attempted path expansion cleverness from cygwin. As you can see from the error, cygwin tries to expand the container path /usr/app into a path that’s valid on Windows.

There are other reports here:

You can try pre-pending winpty, but I haven’t tested that fully.

I personally use the ConEmu terminal with powershell. I know that you may miss out on some unix tools, but it’s more dependable. And the unix tools are right in there in the Linux containers.