今天本来想抽空弄一下openshift,新装了个centos结果docker起不来。
报错内容:
[root@master docker]# systemctl status docker.service -l [0m docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Mon 2018-05-21 23:36:12 PDT; 11s ago Docs: http://docs.docker.com Process: 10724 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: 10724 (code=exited, status=1/FAILURE) May 21 23:36:10 master.example.com systemd[1]: Starting Docker Application Container Engine... May 21 23:36:10 master.example.com dockerd-current[10724]: time="2018-05-21T23:36:10.793396862-07:00" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found" May 21 23:36:10 master.example.com dockerd-current[10724]: time="2018-05-21T23:36:10.795010416-07:00" level=info msg="libcontainerd: new containerd process, pid: 10729" May 21 23:36:11 master.example.com dockerd-current[10724]: time="2018-05-21T23:36:11.800508541-07: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." May 21 23:36:12 master.example.com dockerd-current[10724]: 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) May 21 23:36:12 master.example.com systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE May 21 23:36:12 master.example.com systemd[1]: Failed to start Docker Application Container Engine. May 21 23:36:12 master.example.com systemd[1]: Unit docker.service entered failed state. May 21 23:36:12 master.example.com systemd[1]: docker.service failed.
其中有一句: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)
可以看出来,这个版本的centos不支持selinux 打开docker的配置文件,/etc/sysconfig/docker 在“OPTIONS='--selinux-enabled”后加“=false”,其余不变,保存退出。
再启动,OK