I forget stuff… really!!!

Ubuntu 16.04 – DOCKER_OPTS

Lastweek when spinning up an AWS Instance, I was greeted with an Official Ubuntu 16.04 image.. naturally I would use this image for the new service we were planning..

As all new services we deploy, we run them on Docker. One practice we do in our AWS Docker setup is to store all images in EBS as /mnt/docker.. I’m not going into details of the advantage of this setup.. but usually it is simply modifying the /etc/defaults/docker file setting DOCKER_OPTS=”-g /mnt/docker” ..

Unfortunately Docker installation did not obey this setting

$ docker info | grep "Root dir"
Root Dir: /var/lib/docker/aufs
Docker Root Dir: /var/lib/docker

even though I have correctly updated /etc/default/docker

$ cat /etc/default/docker | grep DOCKER_OPTS
# Use DOCKER_OPTS to modify the daemon startup options.
#DOCKER_OPTS="--dns --dns"
DOCKER_OPTS="-g /mnt/docker"

For that I modified the docker.service file

$ sudo vim /lib/systemd/system/docker.service

adding the following

ExecStart=/usr/bin/dockerd $DOCKER_OPTS -H fd://

reloaded systemctl and restarted docker service

$ sudo systemctl daemon-reload
$ sudo service docker restart

and now Docker installation of Ubuntu 16.04 is storing images in /mnt/docker

$ docker info | grep "Root Dir"
Root Dir: /mnt/docker/aufs
Docker Root Dir: /mnt/docker

Powered by Wordpress | Designed by Elegant Themes