Docker Community Forums

Share and learn in the Docker community.

How to map the current directory?

I am trying to modify a Dockerfile that contained a command

docker container run --rm \
-v "$PWD":/home/gradle/project \
-v "$HOME"/.gradle-docker:/root/.gradle \

to be usable on Windows.
I replaced the $HOME by “~” which amazingly was accepted. Whether it also works still remains to be seen. If not I will try %HOME%.

But since there is no “PWD” env-variable in windows I wanted to replace that with “.” (i.e. the current directory), but then docker barfs at me:

docker: Error response from daemon: create .: volume name is too short, names should be at least two alphanumeric characters.

IMHO that check for >=2 characters is simply wrong! I guess the programmer had “C:” or something similar as minimal path in mind. But ‘.’ is a perfectly valid path!

How do I trick docker to accept “.” as valid directory?