View previous topic :: View next topic |
Author |
Message |
jens n00b
Joined: 31 May 2012 Posts: 3
|
Posted: Thu Feb 26, 2015 11:38 pm Post subject: systemd & docker - how to pass options to the docker dae |
|
|
Hi,
I'm trying to setup docker, my system is using systemd.
Since my / partition is rather limited I'd like to move the docker directory to the /home partition.
I've seen the respective guide here: https://docs.docker.com/articles/systemd/
Since we don't have /etc/sysconfig/docker on Gentoo I tried to create a drop-in systemd unit file containing the following:
Code: |
root:/etc/systemd/system/docker.service.d> cat jens.conf
[Service]
Environment='OPTIONS="--graph /home/docker-data --storage-driver overlay"'
|
Systemd does pick it up:
Code: |
root:/etc/systemd/system> systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib64/systemd/system/docker.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/docker.service.d
└─jens.conf
Active: active (running) since Fri 2015-02-27 00:17:31 CET; 21s ago
Docs: http://docs.docker.com
Main PID: 26025 (docker)
CGroup: /system.slice/docker.service
└─26025 /usr/bin/docker -d -H fd://
|
It also ends up in the environment of the docker process:
Code: | cat /proc/`pidof docker`/environ
LANG=en_US.utf8PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binLISTEN_PID=26150LISTEN_FDS=1OPTIONS="--graph /home/docker-data --storage-driver overlay" |
The docker daemon seems to ignore the setting, though. It still sets up its directories at /var/lib/docker
I believe that's because the guide linked above assumes this line to be present in docker.service:
Code: | ExecStart=/usr/bin/docker -d -H fd:// $OPTIONS |
However on my system the docker.service as installed by the ebuild contains this:
Code: | ExecStart=/usr/bin/docker -d -H fd:// |
Note the missing $OPTIONS at the end.
For now I copied and modified the complete docker.service file to /etc since the ExecStart line cannot be modified by a drop-in.
Am I missing something?
The openrc script and its conf.d file provide the DOCKER_OPTIONS variable but the system service does not.
Please don't mention changing back to openrc. That's not an option
Thanks,
Jens |
|
Back to top |
|
|
RAPHEAD Tux's lil' helper
Joined: 20 Jun 2003 Posts: 134 Location: Germany
|
Posted: Wed Jun 22, 2016 1:04 pm Post subject: |
|
|
Hi, on my system, the file
Code: | /etc/systemd/system/multi-user.target.wants/docker.service |
seems to contain the unit description but it does still not make use of $DOCKER_OPTS.
I think we should create and issue to read them from /etc/default/docker
What do you think? |
|
Back to top |
|
|
HTS Guru
Joined: 20 Feb 2006 Posts: 410 Location: Bristol, UK
|
Posted: Thu Jun 23, 2016 10:55 am Post subject: |
|
|
You're almost there you just need to redefine the ExecStart in your drop-in.
In my case I wanted to add a --storage-driver option, here is what my drop-in looks like:
Code: |
cat /etc/systemd/system/docker.service.d/storage.conf
[Service]
ExecStart=
ExecStart=/usr/bin/docker daemon -H fd:// --graph="/home/docker-data" --storage-driver=overlay
|
Please note that to redefine ExecStart you must first reset it with "ExecStart=" _________________ Plasma desktop on Core i7 8086K OC @ 5GHz, 64GB DDR4, 2 x M.2 Samsung 970 PRO 1TB SSDs |
|
Back to top |
|
|
|