Docker (systemd) ignores change of default directory (docker.service)

dsljanus asked:

I want to deploy docker on a server, but I want all docker-related data to be in a separate partition from the base system. I have thus mounted said partition at ‘/srv’ and made the following changes, according to the official documentation:

This is my ‘/usr/lib/systemd/system/docker.service’ file:

Description=Docker Application Container Engine
Documentation= docker.socket

ExecStart=/usr/bin/docker -d -H fd:// $OPTIONS


This is the ‘/srv/docker/docker.conf’ file that is referenced inside the ‘docker.service’ file:

$OPTIONS="--graph /srv/docker --storage btrfs"

The docker daemon starts correctly and also PULLs images. The problem is that it still does not store anything inside the ‘/srv/docker’ directory.

Also, when I run ‘ps -aux | grep docker’, what I get is this:

root       661  0.4  0.2 351080 17044 ?        Ssl  19:33   0:00 /usr/bin/docker -d -H fd://

The command line stops at ‘fd://’. It seems to me that ‘$OPTIONS’ is being overlooked for one reason or another.

Now, is there a problem with the way I reference the files? Is there something else going on here? The reason I am doing all these configuration changes is that I would really like to keep all docker related data under the ‘/srv/docker/’ directory.

Any ideas?


I changed my ‘docker.conf’ file, as suggested in the answers section. Now:

$OPTIONS="--graph /srv/docker --storage btrfs"


OPTIONS="--graph /srv/docker --storage btrfs"

This had the (unexpected) consequence of the docker daemon not starting. This is the debug message from ‘systemctl status docker’:

[root@V12 ~]# systemctl status docker
‚óŹ docker.service – Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2015-02-05 20:13:31 EET; 14s ago
Process: 776 ExecStart=/usr/bin/docker -d -H fd:// $OPTIONS (code=exited, status=2)
Main PID: 776 (code=exited, status=2)

My answer:

You have an error in your /srv/docker/docker.conf file.

$OPTIONS="--graph /srv/docker --storage btrfs"

The specification of a variable should not start with a $; the $ should only be used when using the variable later.

Change it to:

OPTIONS="--graph /srv/docker --storage btrfs"

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.