Browse Source

Fixup SELinux permissions for docker when using a different graph path

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
Mrunal Patel 6 years ago
parent
commit
6069a314be
1 changed files with 11 additions and 0 deletions
  1. 11 0
      roles/container_runtime/tasks/package_docker.yml

+ 11 - 0
roles/container_runtime/tasks/package_docker.yml

@@ -137,6 +137,17 @@
   changed_when: False
   changed_when: False
   register: r_docker_already_running_result
   register: r_docker_already_running_result
 
 
+- name: Check for docker_storage_path/overlay2
+  stat:
+    path: "{{ docker_storage_path }}/overlay2"
+  register: dsp_stat
+
+- name: Fixup SELinux permissions for docker
+  shell: |
+           semanage fcontext -a -e /var/lib/docker/overlay2 "{{ docker_storage_path }}/overlay2"
+           restorecon -R -v "{{ docker_storage_path }}/overlay2"
+  when: dsp_stat.stat.exists
+
 - name: Start the Docker service
 - name: Start the Docker service
   systemd:
   systemd:
     name: docker
     name: docker