Table of Contents

Docker - Installation for Windows 7 (Docker Toolbox)

About

How I have installed and configured Docker in my Windows 7 laptop. The software for windows 7 is called Docker Toolbox.

Steps

Install Toolbox (for version before Windows 10)

Before version Windows 10: Toolbox:

Toolbox Componentns

Toolbox Components:

Create an host

I don't remember if it's necessary.

docker-machine create ^
    --driver virtualbox ^
    --virtualbox-memory 8192 ^
    --virtualbox-disk-size "40960"  ^
    default
Running pre-create checks...
(test) Default Boot2Docker ISO is out-of-date, downloading the latest release...
(test) Latest release for github.com/boot2docker/boot2docker is v17.09.1-ce
(test) Downloading C:\Users\gerard\.docker\machine\cache\boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v17.09.1-ce/boot2docker.iso...
(test) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
Creating machine...
(test) Copying C:\Users\gerard\.docker\machine\cache\boot2docker.iso to C:\Users\gerard\.docker\machine\machines\test\boot2docker.iso...
(test) Creating VirtualBox VM...
(test) Creating SSH key...
(test) Starting the VM...
(test) Check network to re-create if needed...
(test) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: C:\DockerToolbox\docker-machine.exe env default

The machine runs on the boot2docker operating system

Environment

Variable

docker-machine env
You can further specify your shell with either 'cmd' or 'powershell' with the --shell flag.

SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://192.168.99.100:2376
SET DOCKER_CERT_PATH=C:\Users\gerard\.docker\machine\machines\default
SET DOCKER_MACHINE_NAME=default
SET COMPOSE_CONVERT_WINDOWS_PATHS=true
REM Run this command to configure your shell:
REM     @FOR /f "tokens=*" %i IN ('"C:\DockerToolbox\docker-machine.exe" env') DO @%i

Windows Env

Docker Windows Env Docker Machine

Host

Add a docker host in your host file with the host ip

docker-machine ip
192.168.99.100

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# ...........................
192.168.99.100   docker-host

SSH - Winscp

Create a new connection with the following parameters:

You should be able to see the c and d drive:

Docker Machine Via Winscp

Shared Drive

When mounting a volume with the bind method, your local drive must be made available to the host (in all case on Windows 7 with Toolbox). The steps are well explained also in the VirtualBox Doc on shared folder.

Without following this steps, you can get this kind of issue: Bind mount issue on Docker for Windows)

Step 0 - The default shared folder

By default, you will see already a shared drive with:

It means that the path c:\\Users is already shared.

Docker Default Shared Folder

If you put your files under this directory, you are done. If not, you need to follow the below steps.

Step 1 - Create the shared folder in Virtual Box

Shared Folder Docker

VBoxManage sharedfolder add "default" --name "c" --hostpath "C:\"
VBoxManage sharedfolder add "default" --name "d" --hostpath "D:\"

where:

For info: There are two types of shares:

Step 2 - Mount the shared folder in the docker host

docker-machine ssh 
# docker-machine ssh machineName
sudo su -
# C
mkdir /c
mount -t vboxsf c /c

# D
mkdir /d
mount -t vboxsf d /d
chmod u+x o+x g+x bootlocal.sh 
cd /home/docker
./bootlocal.sh 

Step 3 - Make the mount automatic

sudo su -
cp /home/docker/bootlocal.sh /var/lib/boot2docker/

source local customisation with persistent-partition