Setting up your operating system

In this section, we describe the Docker installation procedure depending on your host system. We will be focusing on the most popular systems; for a full list of supported operating systems, please refer to Docker online documentation: https://docs.docker.com/

Linux (Ubuntu / Debian)

At the time of writing, Docker project supports these Ubuntu/Debian releases:

  • Ubuntu Yakkety 16.10
  • Ubuntu Xenial 16.04 LTS
  • Ubuntu Trusty 14.04 LTS
  • Debian 8.0 (64-bit)
  • Debian 7.7 (64-bit)

For an updated list of supported distributions, you can refer to the Docker project website, at these locations:

Here are the commands needed to install the Docker engine on your local host:

sudo apt-get update
sudo apt-get install wget curl
wget -qO- https://get.docker.com/ | sh

This will register a new location in your “sources.list” file and install the “docker.io” package and its dependencies:

$ cat /etc/apt/sources.list.d/docker.list
$ deb [arch=amd64] https://apt.dockerproject.org/repo ubuntu-xenial main
$ docker --version
Docker version 17.03.0-ce, build 60ccb22

It is then recommended to add your user to the new “docker” system group:

sudo usermod -aG docker *<your-login>*

… and after that, to log out and log in again to have these credentials applied.

You can reboot your system or start the Docker daemon using:

sudo service docker start

If everything went right, you should be able to list all locally available images using:

$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE

In our case, no image is available yet, but the environment is ready to go on.

A SSH client must also be installed:

sudo apt-get install openssh-client

Windows © (7, 8, 8.1, 10)

WARNING: although Windows© can work for this purpose, not only are lots of additional steps needed, but the build process performance itself is suboptimal. Please consider moving to Linux for a better experience.

We will be downloading the latest Docker Toolbox at the following location:

https://www.docker.com/docker-toolbox

and by clicking on the “Download (Windows)” button:

We will answer “Yes”, “Next” and “Install” in the next dialog boxes.

{style width:60%;}

{style width:48%; float:left; margin-right:0.3em} {style width:48%; float:right}

We can then start it by double-clicking on the “Docker Quickstart Terminal” icon:

It will take a certain amount time to setup everything, until this banner appears:

Docker Toolbox provides a 1 Gb RAM/20 Go HDD virtual machine; this is clearly insufficient for our needs. Let us expand it to 4 Gb RAM/50 HDD (these are minimal values; feel free to increase them if your computer has more physical memory and/or free space) :

export VBOXPATH=/c/Program\ Files/Oracle/VirtualBox/
export PATH="$PATH:$VBOXPATH"

docker-machine stop default

VBoxManage.exe modifyvm default --memory 4096
VBoxManage.exe createhd --filename build.vmdk --size 51200 --format VMDK
VBoxManage.exe storageattach default --storagectl SATA --port 2 --medium build.vmdk --type hdd

docker-machine start default

docker-machine ssh default "sudo /usr/local/sbin/parted --script /dev/sdb mklabel msdos"
docker-machine ssh default "sudo /usr/local/sbin/parted --script /dev/sdb mkpart primary ext4 1% 99%"
docker-machine ssh default "sudo mkfs.ext4 /dev/sdb1"
docker-machine ssh default "sudo mkdir /tmp/sdb1"
docker-machine ssh default "sudo mount /dev/sdb1 /tmp/sdb1"
docker-machine ssh default "sudo cp -ra /mnt/sda1/* /tmp/sdb1"

docker-machine stop default

VboxManage.exe storageattach default --storagectl SATA --port 2 --medium none
VboxManage.exe storageattach default --storagectl SATA --port 1 --medium build.vmdk --type hdd

docker-machine start default

We will then finalize the setup:

VboxManage.exe modifyvm default --natpf1 sshredir,tcp,127.0.0.1,2222,,2222
docker-machine start default
docker-machine ssh default "echo mkdir /sys/fs/cgroup/systemd | sudo tee /var/lib/boot2docker/bootlocal.sh"
docker-machine restart default

A SSH client must also be installed. We will grab PuTTY at the following URL: http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe

Mac OS X ©

We will be downloading the latest Docker Toolbox at the following location: https://www.docker.com/docker-toolbox

and by clicking on the “Download (Mac)” button:

We will answer “Continue” and “Install” in the next dialog boxes:

{style width:80%;} {style width:80%;}

Then, when we go to our “Applications” folder, we now have a “Docker” subfolder where we can start “Docker Quickstart Terminal”:

It will take a certain amount of time to setup everything, until this banner appears:

Docker Toolbox provides a 1 Gb RAM/20 Go HDD virtual machine; this is clearly insufficient for our needs. Let us expand it to 4 Gb RAM/50 HDD (these are minimal values; feel free to increase them if your computer has more physical memory and/or free space) :

docker-machine stop default

VboxManage modifyvm default --memory 4096
VboxManage createhd --filename build.vmdk --size 51200 --format VMDK
VboxManage storageattach default --storagectl SATA --port 2 --medium build.vmdk --type hdd

docker-machine start default

docker-machine ssh default "sudo /usr/local/sbin/parted --script /dev/sdb mklabel msdos"
docker-machine ssh default "sudo /usr/local/sbin/parted --script /dev/sdb mkpart primary ext4 1% 99%"
docker-machine ssh default "sudo mkfs.ext4 /dev/sdb1"
docker-machine ssh default "sudo mkdir /tmp/sdb1"
docker-machine ssh default "sudo mount /dev/sdb1 /tmp/sdb1"
docker-machine ssh default "sudo cp -ra /mnt/sda1/* /tmp/sdb1"

docker-machine stop default

VboxManage storageattach default --storagectl SATA --port 2 --medium none
VboxManage storageattach default --storagectl SATA --port 1 --medium build.vmdk --type hdd

docker-machine start default

We will then finalize the setup:

VboxManage modifyvm default --natpf1 sshredir,tcp,127.0.0.1,2222,,2222
docker-machine ssh default "echo mkdir /sys/fs/cgroup/systemd | sudo tee /var/lib/boot2docker/bootlocal.sh"
docker-machine restart default