Docker Service Startup Failure When Using A Custom Docker Directory on Linux

On Linux, you can change where Docker persists its resources from /var/lib/docker to a different directory. This directory contains all of your images, container layers, and volumes, and if your boot volume is small, Docker can quickly dominate the disk.

Most references I’ve seen tell you to update the location by editing the /lib/systemd/system/docker.service configuration file and change the following line:

…by adding an entry with the -g or --graph flag:

Indeed, that works for versions before 17.05. However, in versions 17.05 and later, the -g and --graph options are deprecated. After updating Docker and restarting the service or host, you’ll see this error:

Checking the status of the service shows:

Or:

Or:

The status output will lead you to the cause. Check journalctl -xe and within a few lines you’ll see a message indicating that use of the —-graph flag is deprecated and to instead use —-data-root:

After changing the entry in /lib/systemd/system/docker.service to use the proper flag, Docker once again recognizes the non-default directory and starts normally.

Leave a Reply

Discover more from Oracle Sean

Subscribe now to keep reading and get access to the full archive.

Continue reading