From e78ec48dde231317d07aceb0154c1908c90499b5 Mon Sep 17 00:00:00 2001 From: Brian Becker Date: Fri, 29 Apr 2016 15:00:11 -0400 Subject: [PATCH] Update docker daemon configuration file * According to the official docs files in /usr/lib/systemd/system or /lib/systemd/system contain the defaults and should not be modified * The recommended method to configure the daemon is to place files in /etc/systemd/system/docker.service.d * https://docs.docker.com/engine/admin/systemd/ --- tasks/main.yml | 7 +++---- templates/docker.conf | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 templates/docker.conf diff --git a/tasks/main.yml b/tasks/main.yml index a8ddca7..9a6127b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -74,10 +74,9 @@ when: docker_opts != "" and ansible_distribution_version|version_compare(15.04, '>=') - name: Ensure docker daemon options used (systemd) - lineinfile: - dest: /lib/systemd/system/docker.service - regexp: "ExecStart=/usr/bin/docker daemon -H fd://" - line: ExecStart=/usr/bin/docker daemon -H fd:// $DOCKER_OPTS + template: + src: docker.conf + dest: /etc/systemd/system/docker.service.d/docker.conf notify: - Reload systemd - Restart docker diff --git a/templates/docker.conf b/templates/docker.conf new file mode 100644 index 0000000..cb6d2e5 --- /dev/null +++ b/templates/docker.conf @@ -0,0 +1,3 @@ +[Service] +ExecStart= +ExecStart=/usr/bin/docker daemon -H fd:// $DOCKER_OPTS