Mapping volumes to Docker images in Windows 10

Posted: September 23, 2018 in docker

2 years ago i wrote a post how to map volumes to docker images when docker is running on Linux.Now we’ll see how we can perform same when Docker is running on Windows.

I created a folder php on my Windows 10 (you fist need to create folder dockerfiles otherwise docker run command wont work !)


i put sample php script in it (script.php)


Browse to php folder (cd “path to php script”)

get current folder path:

SET var=%cd%

Following command will create php docker container, create home folder and will copy challenge.php to home  folder (note that we need to use forward slash (/) as we’re on Linux

docker run -it --rm -v "%var%/script.php:/home/challenge.php" php:latest /bin/bash

Docker will prompt for sharing drive and will ask for windows password





File is copied to docker container as we can see in following picture



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s