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"<br />
Root Dir: /var/lib/docker/aufs<br />
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 18.104.22.168 –dns 22.214.171.124”
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<br />
$ sudo service docker restart
and now Docker installation of Ubuntu 16.04 is storing images in /mnt/docker
$ docker info | grep "Root Dir"<br />
Root Dir: /mnt/docker/aufs<br />
Docker Root Dir: /mnt/docker