This page looks best with JavaScript enabled

Problems Using Docker on Windows 7

 ·  β˜• 2 min read

1. Customizing the docker-machine Location

When using Docker on Windows 7, docker-machine is stored by default in the C:\users\your name\.docker\machine\machines directory.

To avoid taking up storage space on the system drive, you can change this as follows.

If you have not created a virtual machine yet, you can specify the location by setting the MACHINE_STORAGE_PATH environment variable.

Then run Docker Quickstart Terminal to create and run docker-machine.

If you have already created a virtual machine, you need to migrate the virtual machine and then restart docker-machine.

2. Directory Mounting

On Windows 7, Docker runs inside the virtual environment provided by VirtualBox. Mounting a directory involves file sharing between three parties:

  • Windows
  • The virtual machine in VirtualBox
  • Docker

Mounting a folder from Windows 7 into Docker goes through the virtual machine and takes two steps:

  • Step one: mount the Windows folder into the virtual machine in VirtualBox

As shown above, open VirtualBox and find a virtual machine named default β€” this virtual machine is the Docker host. Create a shared folder in it, for example mounting D:\ to the /d directory.

Then restart the virtual machine.

1
docker-machine restart
  • Step two: mount the virtual machine’s directory in VirtualBox into Docker

Mount the /d/data directory in the virtual machine to the container’s /data directory

1
docker run -it -v /d/data:/data centos /bin/bash

3. Configuring a Registry Mirror

  • Log into the virtual machine in SSH mode
1
docker-machine ssh default
  • Edit the configuration and add the mirror
1
2
3
4
5
sudo vi /var/lib/boot2docker/profile
EXTRA_ARGS='
--label provider=virtualbox
--registry-mirror=http://f1361db2.m.daocloud.io
'
  • Restart the virtual machine
1
docker-machine restart

WeChat Official Account
WRITTEN BY
WeChat Official Account