浏览代码

Fixup SELinux permissions for docker when using a different graph path

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
Mrunal Patel 6 年之前
父节点
当前提交
6069a314be
共有 1 个文件被更改,包括 11 次插入0 次删除
  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
   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
   systemd:
     name: docker