Skip to content

Conversation

@thaJeztah
Copy link
Member

- What I did

Updated the systemd unit file to allow reloading the daemon configuration;

This adds support for reloading the docker daemon
(SIGHIUP) so that changes in '/etc/docker/daemon.json'
can be loaded at runtime by reloading the service
through systemd ('systemctl reload docker')

Before this change, systemd would output an error
that "reloading" is not supported for the docker
service;

systemctl reload docker
Failed to reload docker.service: Job type reload is not applicable for unit docker.service.

After this change, the docker daemon can be reloaded
through 'systemctl reload docker', which reloads
the configuration;

journalctl -f -u docker.service

May 02 03:49:20 testing systemd[1]: Reloading Docker Application Container Engine.
May 02 03:49:20 testing docker[28496]: time="2016-05-02T03:49:20.143964103-04:00" level=info msg="Got signal to reload configuration, reloading from: /etc/docker/daemon.json"
May 02 03:49:20 testing systemd[1]: Reloaded Docker Application Container Engine.

- How I did it

By adding an ExecReload line to the unit file

- How to verify it

on a host with docker installed and running systemd:

  1. install docker on a system that uses systemd

  2. update /lib/systemd/system/docker.service with the changes in this PR

  3. reload the unit file; systemctl daemon-reload

  4. check the output of docker info

    there should be no "labels"

  5. create /etc/docker/daemon.json, and edit it to look like this:

    {"labels":["foo=bar","bar=baz"]}
    
  6. reload the daemon; systemctl reload docker

  7. check the output of docker info

    the labels are set on the daemon, and visible as part of docker info;

    Labels:
     foo=bar
     bar=baz
    

- Description for the changelog

Add support for reloading the daemon configuration file (daemon.json) through systemd

- A picture of a cute animal (not mandatory but encouraged)

cute-little-fish

This adds support for reloading the docker daemon
(SIGHIUP) so that changes in '/etc/docker/daemon.json'
can be loaded at runtime by reloading the service
through systemd ('systemctl reload docker')

Before this change, systemd would output an error
that "reloading" is not supported for the docker
service;

  systemctl reload docker
  Failed to reload docker.service: Job type reload is not applicable for unit docker.service.

After this change, the docker daemon can be reloaded
through 'systemctl reload docker', which reloads
the configuration;

  journalctl -f -u docker.service

  May 02 03:49:20 testing systemd[1]: Reloading Docker Application Container Engine.
  May 02 03:49:20 testing docker[28496]: time="2016-05-02T03:49:20.143964103-04:00" level=info msg="Got signal to reload configuration, reloading from: /etc/docker/daemon.json"
  May 02 03:49:20 testing systemd[1]: Reloaded Docker Application Container Engine.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah
Copy link
Member Author

Note that systems running upstart (e.g., ubuntu 14.04) already support service reload docker without changes.

ping @runcom @cyphar PTAL

@runcom
Copy link
Member

runcom commented May 2, 2016

Sounds fine to me :)

LGTM

@cpuguy83
Copy link
Member

cpuguy83 commented May 2, 2016

LGTM

1 similar comment
@justincormack
Copy link
Contributor

LGTM

@thaJeztah
Copy link
Member Author

merging, CI is not testing this, and failures are unrelated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants