Is there a way to map the current directory on Windows?

Hi,

I’m looking for a easy way to map the current directory when you do a docker run -v

The idea is to map the current build result directory into a container, independently of the user name of the developer or where he checked out the project

The solution that I’m aware of, is to use the full path to the current directory in a “cygwinied” format (/c/Users/WinUsername/directoryToMap)

The problem with that is that you have to “convert the format” manually from C:\Users\WinUsername\directoryToMap, making it very hard to create a batch file or giving “directory independent” instructions.

IS there a command line trick or a special syntax for map the current directory?
Something like allows me to been in the directory C:\Users\WinUsername\directoryToMap and simply run something similar to

docker run -v cygwinfy(.):/projectDir imageName

Cheers
JD Evora

Hi,

Once you "ssh"ed onto the boot2docker VM, you can provide pwd as the source option to the -v switch and achieve what you are looking to achieve.

Here are the sequence of commands: (start from the MINGW32 bash window)

$ boot2docker ssh

docker@boot2docker:~$

docker@boot2docker:~$ cd /c/Users

docker@boot2docker:~$ cd WinUsername/directoryToMap

docker@boot2docker:~$ docker run -v pwd:/projectDir imageName

I have tested this to work.

-Joe

Thanks ,

The only issue is that I was trying to take advantage to the fact that we now have a native docker client on windows and doing directly from cmd.exe

I use the msys-git supplied bash shell (rather than cmd.exe or powershell).

this means that pwd returns the cygwinified path already.

A couple of things need to change for the standard DOS path to work - including how both the docker client and server parse the --volumes argument.

With the new docker-machine it doesn’t work either due this bug https://github.com/docker/toolbox/issues/80 :frowning:

Hi docsuser,

I’ve installed the git for windows on a windows server 2016 container. Once inside the container via powershell , can see c:\git and all required files inside. However, going into git bash from within the powershell ( inside container ) is fruitless. Tried several things. Can you pls provide some insights into get to git bash inside a windows server 2016 container ?