centos7 yum安装docker-1.13.1启动失败报错
技术积累 Centos7 Docker

解决centos7安装docker后启动报错

安装过程

#安装
yum install docker -y

#安装完启动
[root@localhost ~]# 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.

#查看错误
[root@localhost ~]# journalctl -xe
-- Unit docker-storage-setup.service has begun starting up.
Dec 04 17:24:06 localhost.localdomain systemd[1]: Started Docker Storage Setup.
-- Subject: Unit docker-storage-setup.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker-storage-setup.service has finished starting up.
-- 
-- The start-up result is done.
Dec 04 17:24:06 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...
-- Subject: Unit docker.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has begun starting up.
Dec 04 17:24:06 localhost.localdomain dockerd-current[31162]: time="2018-12-04T17:24:06.207906776+08:00" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found"
Dec 04 17:24:06 localhost.localdomain dockerd-current[31162]: time="2018-12-04T17:24:06.211062772+08:00" level=info msg="libcontainerd: new containerd process, pid: 31168"
Dec 04 17:24:07 localhost.localdomain dockerd-current[31162]: Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel. Either boot into a newer kernel or disable se
Dec 04 17:24:07 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Dec 04 17:24:07 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has failed.

解决(主要还是selinux的问题)

方法1
#修改文件参数为 --selinux-enabled=false
vim /etc/sysconfig/docker
OPTIONS='--selinux-enabled=false --log-driver=journald --signature-verification=false'
if [ -z "${DOCKER_CERT_PATH}" ]; then
    DOCKER_CERT_PATH=/etc/docker
fi

#然后重新启动
[root@localhost ~]# systemctl start docker
[root@localhost ~]# ps -ef |grep docker
root     31489     1  3 17:28 ?        00:00:00 /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 --selinux-enabled=false --log-driver=journald --signature-verification=false --storage-driver overlay2
root     31495 31489  1 17:28 ?        00:00:00 /usr/bin/docker-containerd-current -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc --runtime-args --systemd-cgroup=true
root     31595 28513  0 17:28 pts/4    00:00:00 grep --color=auto docker

方法2
关闭系统selinux,重启机器再启动docker

centos7 yum安装docker-1.13.1启动失败报错


本文最后记录时间 2024-03-31
文章链接地址:
https://me.jinchuang.org/archives/331.html
本站文章除注明[转载|引用|来源],均为本站原创内容,转载前请注明出处
Docker容器添加host
Docker 设置网络代理
Docker build报错 DeadlineExceeded: failed to fetch oauth token: Post "https://auth.docker.io/token"
yum安装出现error: %pre() scriptlet failed, exit status 1, Error in PREIN scriptlet in rpm package 错误

centos7 安装docker-ce

Microsoft Office for Mac 2019

留言

顶部