“Print Working Directory” (PWD) is a current working folder. It is often used for do a relative path manipulation.

Docker Volumes (docker run -v ...) are used to bring data content (files) inside a docker container.

The challenge in using volumes is that the behavior of current working directory (pwd) depends on your shell / terminal and your operation system.

Start of a apache based php server with an image from docker hub. The server is listening on Port 8080, and shows the content of the current folder.

docker run -d -p 8080:80 --name my-apache-php-example -v "$PWD":/var/www/html php:7.2-apache

Here a few examples of mapping a local folder _site relative from the current directory $(pwd) to /var/www/html inside a docker php-apache container, with docker run.

Placeholder Command Description
$pwd -v $PWD/_site:/var/www/html Default Notation
$(pwd) -v $(pwd)/_site:/var/www/html Mac / Linux Terminal
%cd% -v %cd%\_site:/var/www/html Windows Command Window Syntax (HINT: use \ as path separator)
${PWD} -v ${PWD}/_site:/var/www/html Powershell Windows Desktop
/$(pwd) -v /$(pwd)/_site:/var/www/html Git Bash on Windows

References

Code With Dan