D
D
Dmitry2016-09-12 08:51:11
Windows
Dmitry, 2016-09-12 08:51:11

Why doesn't docker map directories on Windows 7?

Hello dear All!
I ran into a situation - there is a configured and working package for docker-compouse and everything works fine in Linux. But the task was to run all this in Windows 7/8/10. I installed Docker on Windows using docker-toolbox and everything seems to be assembled and running, BUT in the docker-compose file I have settings for partition mapping:

application:
           build: ./application
    volumes:
            - /с/user/company/master:/var/www

and for a specific container I include a section
workspace:
        build:
          context: ./workspace
        volumes_from:
            - application

After build + up -d, logically, I enter the container:
docker exec -it workspace bash
And when I get to /var/www, I should see the contents of the /c/user/company/master (c:\user\company\master) Windows directory
But this does not happen, but Incomprehensible to me logic, either the directory is empty stupidly, or if I specify to mount on the directory above, then I have an empty master directory. Maybe I'm somehow not prescribing the path correctly, or does Windows need some special spells and shamanism?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Dmitry, 2016-09-12
@Demi44

In general, the solution seemed to be simple, the difficulty was to read the documentation to the right place, given that the docker in Windows is over virtualization ....
In general, for the necessary actions with mounting the ball, you must take into account that the docker in Windows 7 works through virtualbox + cropped-slaughtered Linux Tiny, and in this virtual linux, docker actually works. It should be taken into account that by default VirtualBox mounts c:\Users\ and through it the docker will access the necessary directories. After I put the data of interest to me in c: \ Users - I distorted the virtual machine and rebuilt the necessary images - everything appeared and worked.

P
Pavel, 2016-09-12
@pvlg

Because under windows docker runs in vm, then it needs files inside vm. As an option, share files inside vm.

E
Eugene Pedya, 2018-08-20
@fpinger

If you work from under docker tols (windows 7), then you need to add a shared folder in VirtualBox in the settings that is different from C:\Users After all, this is exactly what I wanted. At the same time, give it a convenient name and check the auto connection box.
For example, the folder "C:\projects" can be named "c/projects" (with / - this is to understand on which disk).
All this is done with the docker machine stopped. In other words, if the docker console is running, then:
docker-machine stop
And after making the settings:
docker-machine start
Next, you can mount existing folders inside it:
docker run -v /c/projects/<path to the folder to be mounted>:<folder to container> <image name>

D
Damir, 2019-01-24
@ddem

Faced such a problem, the nginx config is mapped as a directory, and the directory is empty

nginx:
    image: nginx:1.15.0
    container_name: 'nginx'
    working_dir: /app
    ports:
      - '80:80'
    volumes:
      - /c/work/OSPanel/domains/docker/docker/nginx/nginx.conf:/etc/nginx/nginx.conf

Virtualbox mounts the /c/Users folder by default, adding the entire disk to the virtual machine helped
The file became a file
The folder became a folder
5c4965d0d17d0566545441.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question