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
After=network.target 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 Docs: http://docs.docker.com Process: 776 ExecStart=/usr/bin/docker -d -H fd:// $OPTIONS (code=exited, status=2) Main PID: 776 (code=exited, status=2)

  • What happens if you alter ExecStart to include the line "--graph /srv/docker --storage btrfs" instead? Feb 5, 2015 at 15:35
  • @MatthewIfe I tried it and the daemon refuses to start. The debug message says that the 'ExecStart' line is to blame. Also, please take a look at the update I made to the question.
    – dlyk1988
    Feb 5, 2015 at 15:37
  • Does that work if you manually invoke docker on the command line with all the options you want? Feb 5, 2015 at 15:54

3 Answers 3


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"
  • Please see my update.
    – dlyk1988
    Feb 5, 2015 at 16:19
  • 1
    Well, at least now your environment file works :) Feb 5, 2015 at 16:30
  • 1
    I am so going to put this up for a bounty.
    – dlyk1988
    Feb 5, 2015 at 16:37

First off I want to thank @MichaelHampton for his answer. It was spot on, and I would have never spotted the typo with the '$' ('OPTIONS=...' instead of '$OPTIONS=...').

Now, the problem was with the command line options. In the docker documentation the argument for changing the storage driver is given as:

--storage btrfs

Keep in mind that this is the docs for version 1.4, which is the version I have. Alas, the correct syntax, as evidenced by 'docker --help' is:

--storage-driver btrfs

So, after making the necessary change, the daemon starts correctly, the images are PULL-ed inside the '/srv/docker' directory, and everything is fine.

The moral is to always be a little mistrustful of official documentations, especially for projects under heavy development, like Docker. Again thanks to all for their contributions.


Initially I spent quite a bit of time fiddling with the previous upstart/sysv initscript from /etc/init.d/docker and its configuration file /etc/default/docker. It was really strange that it just didn't work no matter what I tried, then eventually I realized that systemd just ignores both of those, since I was using the legacy script directly.

The proposed solution doesn't seem to work 100% on my 15.04 with lxc-docker-1.7.0 installed from the official docker PPA, since the EnvironmentFile seems to be missing from my docker's systemd configuration file.

An option would be to edit it in-place and add it using this command:

sudo systemctl edit docker --full

But this risks to be overridden by the next update, so my solution was to instead create an override, by running

sudo systemctl edit docker

Then I decided to just redefine the ExecStart command in the new configuration override, instead of also adding and referencing a new configuration file under /srv/docker/docker.conf.

ExecStart=/usr/bin/docker -d -H fd:// --storage btrfs

There's no error in the snippet above, for some strange reason that has to do with the way systemd reads its configuration overrides, a value needs to be first defined with an empty value, then reassigned to the new value.

Once I did this the daemon started happily and I was finally able to use it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.