docker启动时报错

[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.

根据 提示输入 systemctl status docker.service查看错误信息

[root@localhost ~]# systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2018-07-24 07:25:18 EDT; 4min 0s ago
     Docs: http://docs.docker.com
  Process: 5559 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: 5559 (code=exited, status=1/FAILURE)

Jul 24 07:25:17 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...
Jul 24 07:25:17 localhost.localdomain dockerd-current[5559]: time="2018-07-24T07:25:17.162995126-04:00" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found"
Jul 24 07:25:17 localhost.localdomain dockerd-current[5559]: time="2018-07-24T07:25:17.175471399-04:00" level=info msg="libcontainerd: new containerd process, pid: 5563"
Jul 24 07:25:17 localhost.localdomain dockerd-current[5559]: /etc/sysconfig/docker: line 1: i#: command not found
Jul 24 07:25:18 localhost.localdomain dockerd-current[5559]: time="2018-07-24T07:25:18.219449597-04:00" level=warning msg="overlay2: the backing xfs filesystem is formatted without d_type support, which leads to incorrect behavior. Reformat the filesystem with ftype=1 to enable d_type support. Running without d_type support will no longer be supported in Docker 1.16."
Jul 24 07:25:18 localhost.localdomain dockerd-current[5559]: Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel. E...d=false)
Jul 24 07:25:18 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Jul 24 07:25:18 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
Jul 24 07:25:18 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
Jul 24 07:25:18 localhost.localdomain systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

得到关键信息:

time="2018-07-24T07:25:17.162995126-04:00" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found"

time="2018-07-24T07:25:18.219449597-04:00" level=warning msg="overlay2: the backing xfs filesystem is formatted without d_type support, which leads to incorrect behavior. Reformat the filesystem with ftype=1 to enable d_type support. Running without d_type support will no longer be supported in Docker 1.16."

 

 

此处意思是linux的内核中的SELinux不支持 overlay2 graph driver ,解决方法有两个,要么启动一个新内核,要么就在docker里禁用selinux,–selinux-enabled=false,

 

解决方法:

修改docker文件

vi /etc/sysconfig/docker

i# /etc/sysconfig/docker

# Modify these options if you want to change the way the docker daemon runs
OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false'
if [ -z "${DOCKER_CERT_PATH}" ]; then
    DOCKER_CERT_PATH=/etc/docker
fi

# Do not add registries in this file anymore. Use /etc/containers/registries.conf
# from the atomic-registries package.
#

# Location used for temporary files, such as those created by
# docker load and build operations. Default is /var/lib/docker/tmp
# Can be overriden by setting the following environment variable.
# DOCKER_TMPDIR=/var/tmp

# Controls the /etc/cron.daily/docker-logrotate cron job status.
# To disable, uncomment the line below.
# LOGROTATE=false

# docker-latest daemon can be used by starting the docker-latest unitfile.
# To use docker-latest client, uncomment below lines

–selinux-enabled=false

在–selinux-enabled后面加上"=false"

然后重新systemctl start docker来启动docker

 

 

 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐