Configure Docker 1.11.2 in Ubuntu 15.10

Install latest docker version.

wget -qO- | sh

The wget option “O-” indicates that the document should be printed in the standard output while “q” option to turns off the wget output so you will not see the contents of the wget. The shell script is the executed.

You will be able to check the version of Docker installed using,

docker --version

which would give the following output.

Docker version 1.11.2, build b9f10c9

With this Ubuntu version the docker daemon doesn’t use the configurations in /etc/default/docker.

First of all log in as the root user using the following command.

sudo su

Check the docker status using following command.

systemctl status docker

which would give the following output.

It indicates that the systemd configuration file (/lib/systemd/system/docker.service) is used to load the service while the docker daemon is launched with parameter -H fd://

When you see the contents of /lib/systemd/system/docker.service using

cat /lib/systemd/system/docker.service

you can see that the issue is that ExecStart param uses a static value instead of the DOCKER_OPTS variable.

So our solution is to set the /etc/default/docker file as an Environment File and use the DOCKER_OPTS variable in the ExecStart line.

First add the value DOCKER_OPTS=” — debug -H tcp:// -H unix:///var/run/docker.sock” to the /etc/default/docker file.

vim /etc/default/docker 

Next we create a conf file in this specific systemd folder /etc/systemd/system/docker.service.d so that the default configurations can be overridden. Be sure to create the folder if it doesn’t exist.

mkdir -p /etc/systemd/system/docker.service.d 
vim /etc/systemd/system/docker.service.d/ubuntu.conf

Add the following content to the ubuntu.conf file.

# workaround to include default options
ExecStart=/usr/bin/docker daemon-H fd:// $DOCKER_OPTS

Now we have to reload systemd’s config and restart the docker service using the following commands.

systemctl daemon-reload
systemctl status docker.service

Now you will be able to see the following output where you can see that the configuration in /etc/default/docker has been identified by the docker service.

That’s all. Now you can use docker with the your own configurations.

UPDATE: If you make any changes to the DOCKER_OPTS variable after the initial configuration make sure to run the following command in the terminal for the changes to take effect.

systemctl restart docker
Like what you read? Give Sabra Ossen a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.