Docker 1.x logo

Install Docker Engine

Docker Engine 1.10.2 requires a 64-bit OS with at least kernel version 3.10. Official Debian repositories are a few versions behind with Docker versions it is best to install it directly from Docker’s APT repository.

$ apt-get install linux-image-4.3.0-0.bpo.1-amd64
$ vi /etc/default/grub
GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"
$ update-grub
$ reboot
$ apt-key adv --keyserver hkp:// --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
$ echo 'deb debian-jessie main' > /etc/apt/sources.list.d/docker.list
$ apt-get update
$ apt-get install docker-engine

Journald logging driver

Debian 8 switched to systemd as its default system and service manager, so it would make sense to also store log messages from containers in systemd journal (journald logging driver). Also note that Docker by default logs messages to a JSON file (json-file logging driver) that can get corrupted in some situations.

Logging driver can be configured by passing the --log-driver=journald option to the Docker daemon. Afterwards log messages can be retrieved with:

$ journalctl CONTAINER_NAME=web

Overlay storage driver

The default aufs storage driver is production-ready and stable, but it is not efficient under high write activity and not included in mainline Linux kernel. Recently overlay storage driver is gaining popularity and available in kernel since 3.18 (apt-get install linux-image-4.3.0-0.bpo.1-amd64).

Storage driver can be enforced by passing the --storage-driver=overlay option to the Docker daemon.

Configure systemd unit

Docker daemon needs to be configured to start with above options as a systemd service:

$ mkdir /etc/systemd/system/docker.service.d/
$ cat > /etc/systemd/system/docker.service.d/10-execstart.conf << __EOF__
ExecStart=/usr/bin/docker daemon -H fd:// --storage-driver=overlay --icc=false --iptables=true
$ systemctl daemon-reload && systemctl restart docker

Check if Docker daemon is set up correctly:

$ docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 1.10.2
Storage Driver: overlay
 Backing Filesystem: extfs
Execution Driver: native-0.2
Logging Driver: journald
 Volume: local
 Network: host bridge null
Kernel Version: 4.3.0-0.bpo.1-amd64
Operating System: Debian GNU/Linux 8 (jessie)
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 7.697 GiB
Name: m1
$ docker run -it --rm debian /bin/echo "WOOHOOO"
Unable to find image 'debian:latest' locally
latest: Pulling from library/debian
fdd5d7827f33: Pull complete 
a3ed95caeb02: Pull complete 
Digest: sha256:e7d38b3517548a1c71e41bffe9c8ae6d6d29546ce46bf62159837aad072c90aa
Status: Downloaded newer image for debian:latest