Keep calm and configure Docker on Linux Mint

Claudia Minardi
NEXT Engineering
2 min readAug 1, 2016

--

At the office we like to work in comfortable and familiar environments, meaning everyone is free to use their preferred OS and distro — even if this means sometimes running in unexpected development trouble.

A big part of our development environment is centered around Docker: we love how it allows us to get up and running locally with the minimum amount of time and effort. Sometimes, however, things don’t go as planned.

What’s the problem?

I just installed Linux Mint 18 “Sarah”, using lvm to handle partitions, and while setting up my development environment, I’m hit by a nasty surprise: the freshly installed Docker doesn’t start.

After following all the steps for installing Docker, running `apt-get install docker-engine` fails with:

Job for docker.service failed because the control process exited with  error code. See "systemctl status docker.service" and "journalctl -xe"  for details.

Going deeper in what is the cause, systemctl tells me:

Error starting daemon: error initializing graphdriver:  \"/var/lib/docker\" contains several valid graphdrivers: aufs,  devicemapper;

Indeed, looking into /var/lib/docker, both aufs and devicemapper are available. All in all, Docker looks installed properly; the problem seems to be in starting it correctly.

Simple solution: configure it!

Since I want devicemapper as a storage driver, I configure my volumes and create the thinpool as required. At the end of this process, however, the thinpool seems to be inactive.

$ lvscan
ACTIVE '/dev/mint-vg/root' [400,00 GiB] inherit
ACTIVE '/dev/mint-vg/swap_1' [7,95 GiB] inherit
inactive '/dev/mint-vg/thinpool' [54,00 GiB] inherit
$ ls /dev/mapper/
control mint--vg-root mint--vg-swap_1

After a bit of searching for what this means, it turns out the solution lies in installing thin-provisioning-tools, and setting the correct flag by running:

$ lvchange -a y /dev/mint-vg/thinpool

A simple check shows that the thinpool is now active.

$ lvscan
ACTIVE '/dev/mint-vg/root' [400,00 GiB] inherit
ACTIVE '/dev/mint-vg/swap_1' [7,95 GiB] inherit
ACTIVE '/dev/mint-vg/thinpool' [54,00 GiB] inherit
$ ls /dev/mapper/
control mint--vg-root mint--vg-swap_1 mint--vg-thinpool mint--vg-thinpool_tdata mint--vg-thinpool_tmeta

The last step is putting together the docker configuration file as instructed in the documentation, specifying the preferred storage option.

[Service]
ExecStart=
ExecStart=/usr/bin/docker daemon -H fd:// --storage-driver=devicemapper --storage-opt=dm.thinpooldev=/dev/mapper/mint--vg-thinpool --storage-opt dm.use_deferred_removal=true

All done! Now I just need to reload the daemon, and Docker starts without a hitch.

Happy coding!

Want to learn more about coding? Have a look to our other articles.

Photo: Jamie

--

--