centos7 啟動docker失敗
阿新 • • 發佈:2018-11-16
現象:Centos7.3通過yum安裝完docker後,啟動docker失敗
機器的系統版本:CentOS Linux release 7.3.1611 (Core)
centos7,執行完安裝命令: yum -y install docker
執行啟動命令: systemctl start docker ,報如下錯誤:
[[email protected] lib]# systemctl start docker Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
[[email protected] lib]# systemctl status docker ● 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-11-17 01:10:23 CST; 1min 20s ago Docs: http://docs.docker.com Process: 11743 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: 11743 (code=exited, status=1/FAILURE) 11月 17 01:10:21 localhost.localdomain systemd[1]: Starting Docker Application Container Engine... 11月 17 01:10:21 localhost.localdomain dockerd-current[11743]: time="2018-11-17T01:10:21.635497926+08:00" level=warning msg=...und" 11月 17 01:10:21 localhost.localdomain dockerd-current[11743]: time="2018-11-17T01:10:21.637443612+08:00" level=info msg="li...750" 11月 17 01:10:23 localhost.localdomain dockerd-current[11743]: Error starting daemon: SELinux is not supported with the over...lse)11月 17 01:10:23 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE 11月 17 01:10:23 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine. 11月 17 01:10:23 localhost.localdomain systemd[1]: Unit docker.service entered failed state. 11月 17 01:10:23 localhost.localdomain systemd[1]: docker.service failed. Hint: Some lines were ellipsized, use -l to show in full.
報錯資訊:Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel. Either boot into a newer kernel or disable selinux in docker (--selinux-enabled=false)
原因分析: 此linux的核心中的SELinux不支援 overlay2 graph driver ,解決方法有兩個,要麼啟動一個新核心,要麼就在docker裡禁用selinux,--selinux-enabled=false
重新編輯docker配置檔案:
[[email protected] lib]# vi /etc/sysconfig/docker
# /etc/sysconfig/docker
# Modify these options if you want to change the way the docker daemon runs
OPTIONS='--selinux-enabled=false --log-driver=journald --signature-verification=false'
if [ -z "${DOCKER_CERT_PATH}" ]; then
DOCKER_CERT_PATH=/etc/docker
"/etc/sysconfig/docker" 26L, 1100C written
[[email protected] lib]# systemctl start docker
[[email protected] lib]#
重新啟動docker服務:systemctl start docker