Rewrite docker daemon command for Red Hat systems 14/15314/1
authorEric Ball <eball@linuxfoundation.org>
Wed, 17 Apr 2019 17:09:08 +0000 (10:09 -0700)
committerEric Ball <eball@linuxfoundation.org>
Wed, 17 Apr 2019 17:09:08 +0000 (10:09 -0700)
The default daemon command includes options, which are incompatible
with options that are supplied via daemon.json. This fix was already
implemented for Ubuntu, but was thought at the time to be system-
specific. It appears it just took longer for the bug to show up on
CentOS systems.

Issue: RELENG-1903
Change-Id: I2cf7dfa4dfbda87ac76e0e1c7fe36338d69a3779
Signed-off-by: Eric Ball <eball@linuxfoundation.org>
tasks/main.yml

index 4414c8d..15f021f 100644 (file)
@@ -91,9 +91,9 @@
         line: '  "mtu": {{ mtu }},'
   become: true
 
-# The systemd file on Ubuntu system passes `-H fd://` which seems to break
-# and prevent Docker from coming online. Use the same ExecStart line as
-# Docker CE CentOS does to fix the file.
+# There is a known bug with using a daemon.json file and passing the default
+# cli options to the daemon. We must replace the ExecStart command with one
+# that does not have any options.
 - name: Fix broken systemd file on Ubuntu
   lineinfile:
     path: /lib/systemd/system/docker.service
   when: ansible_distribution == 'Ubuntu'
   become: true
 
+- name: Fix broken systemd file on Red Hat
+  lineinfile:
+    path: /usr/lib/systemd/system/docker.service
+    regexp: '^ExecStart='
+    line: 'ExecStart=/usr/bin/dockerd'
+  when: ansible_os_family == 'RedHat'
+  become: true
+
 - name: Enable Docker service
   service: name=docker enabled=true
   when: docker_service_enable