Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker 1.7 systemd unit files does not source /etc/sysconfig/docker #14323

Closed
tkinz27 opened this issue Jul 1, 2015 · 4 comments
Closed

Docker 1.7 systemd unit files does not source /etc/sysconfig/docker #14323

tkinz27 opened this issue Jul 1, 2015 · 4 comments

Comments

@tkinz27
Copy link

tkinz27 commented Jul 1, 2015

Description of problem:

The systemd unit files that were installed do not use the EnvironmentFile option to source the /etc/sysconfig/docker file. Specifically I cannot change the options to docker without directly editing /usr/lib/systemd/system/docker.service

docker version:

[vagrant@localhost ~]$ sudo docker --version
Docker version 1.7.0, build 0baf609

docker info:

[vagrant@localhost ~]$ sudo docker info
Containers: 10
Images: 547
Storage Driver: devicemapper
 Pool Name: docker-253:1-201934556-pool
 Pool Blocksize: 65.54 kB
 Backing Filesystem: xfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 21.14 GB
 Data Space Total: 107.4 GB
 Data Space Available: 18.73 GB
 Metadata Space Used: 30.56 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.117 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.93-RHEL7 (2015-01-28)
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.10.0-123.el7.x86_64
Operating System: CentOS Linux 7 (Core)
CPUs: 1
Total Memory: 1.798 GiB
Name: localhost.localdomain
ID: MXZX:TXOP:HRMS:VHUY:P75X:JFVT:FL2R:KNP2:6RKS:ZNFE:ZD4I:XKKQ

uname -a:

[vagrant@localhost ~]$ uname -a
Linux localhost.localdomain 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Environment details (AWS, VirtualBox, physical, etc.):

$script = <<SCRIPT
#!/bin/bash
sudo yum install -y epel-release
sudo yum upgrade -y
sudo yum install -y git vim python-pip tmux tree
sudo yum install -y https://get.docker.com/rpm/1.7.0/centos-7/RPMS/x86_64/docker-engine-1.7.0-1.el7.centos.x86_64.rpm

sudo cp /vagrant/docker.conf /etc/sysconfig/docker
SCRIPT

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "chef/centos-7.0"
  config.vm.box_download_insecure = true

  config.ssh.forward_agent = true
  config.ssh.forward_x11 = true

  config.vm.synced_folder $HOMEDIR, $HOMEDIR

  config.vm.network "private_network", ip: "192.168.50.4"

  config.vm.provider "virtualbox" do |vb|
    vb.customize ["modifyvm", :id, "--memory", "2048"]
  end

  config.vm.provision "shell", inline: $script
end

So after a vagrant up I get...

vagrant@localhost ~]$ cat /etc/system-release
CentOS Linux release 7.1.1503 (Core)

And /vagrant/docker.conf:

# /etc/sysconfig/docker

# Modify these options if you want to change the way the docker daemon runs
OPTIONS=--selinux-enabled -H 0.0.0.0:2375

Actual Results:

[vagrant@localhost ~]$ ps -ef | grep docker
root     27648     1  0 16:20 ?        00:00:00 /usr/bin/docker -d -H fd://

Expected Results:

[vagrant@localhost ~]$ ps -ef | grep docker
root     27848     1  2 16:35 ?        00:00:00 /usr/bin/docker -d -H 0.0.0.0:2375

Additional info:

The provided systemd unit file

cat /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket

[Service]
ExecStart=/usr/bin/docker -d -H fd://
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity

[Install]
WantedBy=multi-user.target

And this is how I changed it to get the expected results.

cat /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.target docker.socket
Requires=docker.socket

[Service]
EnvironmentFile=-/etc/sysconfig/docker
ExecStart=/usr/bin/docker -d $other_args
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity

[Install]
WantedBy=multi-user.target
@phemmer
Copy link
Contributor

phemmer commented Jul 1, 2015

This is a popular issue :-P
For some more info on the subject, see:
#14319
#14130
#13923. Also #13923 (comment) which has some more references.

@tkinz27
Copy link
Author

tkinz27 commented Jul 1, 2015

my bad, need to do a better job with my searches. Sorry for the dup.

I understand that for a generic package that you would not handle sourcing the /etc/{default,sysconfig}/docker file in the installed systemd unit file. I just assumed since I was installing a package that seemed ( at least based on the filename https://get.docker.com/rpm/1.7.0/centos-7/RPMS/x86_64/docker-engine-1.7.0-1.el7.centos.x86_64.rpm
) that it was designed for centos that it would cater to the distribution.

Anyways feel free to close this dup.

@LK4D4
Copy link
Contributor

LK4D4 commented Jul 2, 2015

Closing as dup :)

@bacoboy
Copy link

bacoboy commented Jul 9, 2015

Still an issue in the RPM. See #14149 (comment)

Master branch still shows no consumption of /etc/sysconfig configurations:
https://github.com/docker/docker/blob/04c6f09fbdf60c7765cc4cb78883faaa9d971fa5/contrib/init/systemd/docker.service#L8

This isn't a dup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants