When using Debian 8 and the latest official Docker installed with the official repository from docker, the systemd configuration does not obey the /etc/default/docker configuration file. This is a little bit annoying as it is a logical and convention to put arguments for the daemon there.

This can easily be fixed by changing the systemd service file for Docker. Let's do it!

What we are going to do is to pass /etc/default/docker to systemd as an environment file and then pass the DOCKER_OPTS variable to the Docker daemon.

Lets open /lib/systemd/system/docker.service:

[Unit]Description=Docker Application Container EngineDocumentation=https://docs.docker.comAfter=network.target docker.socketRequires=docker.socket[Service]Type=notify# the default is not to use systemd for cgroups because the delegate issues still# exists and systemd currently does not support the cgroup feature set required# for containers run by dockerEnvironmentFile=-/etc/default/dockerExecStart=/usr/bin/dockerd $DOCKER_OPTS -H fd://ExecReload=/bin/kill -s HUP $MAINPID# Having non-zero Limit*s causes performance problems due to accounting overhead# in the kernel. We recommend using cgroups to do container-local accounting.LimitNOFILE=infinityLimitNPROC=infinityLimitCORE=infinity# Uncomment TasksMax if your systemd version supports it.# Only systemd 226 and above support this version.#TasksMax=infinityTimeoutStartSec=0# set delegate yes so that systemd does not reset the cgroups of docker containersDelegate=yes# kill only the docker process, not all processes in the cgroupKillMode=process[Install]WantedBy=multi-user.target

Simply add EnvironmentFile and pass the variable to the ExecStart parameter: