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:
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=network.target docker.socket
Requires=docker.socket
[Service]
Type=notify
EnvironmentFile=-/srv/docker/docker.conf
ExecStart=/usr/bin/docker -d -H fd:// $OPTIONS
LimitNOFILE=1048576
LimitNPROC=1048576
[Install]
Also=docker.socket
WantedBy=multi-user.target
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?
UPDATE 1:
I changed my 'docker.conf' file, as suggested in the answers section. Now:
$OPTIONS="--graph /srv/docker --storage btrfs"
became:
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)