代码之家  ›  专栏  ›  技术社区  ›  aircraft

将selinux状态设置为“permitive”,仍然无法运行docker

  •  -1
  • aircraft  · 技术社区  · 6 年前

    安装Docker之后,我已经将SELinux状态设置为 Permissive ,仍然不能运行Docker。

    在我的 /etc/selinux/config ,我已经编辑了 SELINUX=disabled .

    setenforce 0 ,检查:

    # getenforce
    Permissive 
    

    我使用 systemctl start docker ,但失败,获取以下错误:

    # systemctl status docker.service
    ● docker.service - Docker Application Container Engine
       Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
       Active: failed (Result: exit-code) since 五 2018-06-29 09:05:47 CST; 14s ago
         Docs: http://docs.docker.com
      Process: 21615 ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --init-path=/usr/libexec/docker/docker-init-current --seccomp-profile=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, status=1/FAILURE)
     Main PID: 21615 (code=exited, status=1/FAILURE)
    
    6月 29 09:05:46 123.xyz systemd[1]: Starting Docker Application Container Engine...
    6月 29 09:05:46 123.xyz dockerd-current[21615]: time="2018-06-29T09:05:46.451911058+08:00" level=warning msg="could not ch...found"
    6月 29 09:05:46 123.xyz dockerd-current[21615]: time="2018-06-29T09:05:46.453472267+08:00" level=info msg="libcontainerd: ...21626"
    6月 29 09:05:47 123.xyz dockerd-current[21615]: time="2018-06-29T09:05:47.463085812+08:00" level=warning msg="overlay2: the back...
    6月 29 09:05:47 123.xyz dockerd-current[21615]: Error starting daemon: SELinux is not supported with the overlay2 graph dr...false)
    6月 29 09:05:47 123.xyz systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
    6月 29 09:05:47 123.xyz systemd[1]: Failed to start Docker Application Container Engine.
    6月 29 09:05:47 123.xyz systemd[1]: Unit docker.service entered failed state.
    6月 29 09:05:47 123.xyz systemd[1]: docker.service failed.
    Hint: Some lines were ellipsized, use -l to show in full.
    

    为什么还说:

    启动守护程序时出错:覆盖图dr…false不支持selinux)

    我的Linux是 CentOS 7.2

    1 回复  |  直到 6 年前
        1
  •  0
  •   aircraft    6 年前

    我找到了解决办法。

    /etc/sysconfig/docker 以下内容:

    OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false'
    if [ -z "${DOCKER_CERT_PATH}" ]; then
        DOCKER_CERT_PATH=/etc/docker
    fi
    

    设置 -selinux-enabled --selinux-enabled=false .