0

The goal:

share project directory on Windows to the container, with docker toolbox

for the testing, I took this php:5.6.15-apache

What I did:

I have tried a few recommendations:

  1. run with options -v

    docker run --name=simple2 --rm -v "/c/Users/Admin/pr:/var/www/html" -p 80:80 -p 8080:8080 -d php:5.6.15-apache
    
  2. Create a shared directory in default VM

enter image description here

and mount it inside default docker container

   mkdir /home/docker/pr
   mount -t vboxsf -o uid=1000,gid=50 pr /home/docker/pr
  1. Run container with mounting on the shared directory, in this case creates a directory inside docker with name pr

    docker run -d --name simple2 -it -v /var/www/html:/pr -p 80:80 -p 8080:8080 -d php:5.6.15-apache
    
    
    docker inspect simple2
    
    "Mounts": [
        {
            "Type": "bind",
            "Source": "/var/www/html",
            "Destination": "/pr",
            "Mode": "",
            "RW": true,
            "Propagation": "rprivate"
        }
    ],
    

none of this didn't follow me to the success. I mean none of this steps doesn't share the code between php:5.6.15-apache and Windows

Where did I do wrong?

eLRuLL
  • 18,488
  • 9
  • 73
  • 99
Maxim R
  • 199
  • 1
  • 1
  • 9

2 Answers2

0

Try

docker run --rm --name simple2 -v /home/docker/pr:/var/www/html -p 80:80 -p 8080:8080 -d php:5.6.15-apache

  • Please explain how this answer is different from what the asker tried, and how you think it would solve the problem. – ecnepsnai Jan 03 '18 at 19:43
0

Just share the root of drive c:\

enter image description here

It's better to restart your default VM then try to run your first command :

docker run --name=simple2 --rm -v "/c/Users/Admin/pr:/var/www/html" -p 80:80 -p 8080:8080 -d php:5.6.15-apache

Ghominejad
  • 1,572
  • 16
  • 15