部署kubenetes啓動docker容器報錯

[root@centos-minion yum.repos.d]# 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看到提示

[root@centos-minion yum.repos.d]# 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 六 2019-05-11 20:53:05 CST; 6s ago
     Docs: http://docs.docker.com
  Process: 13939 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: 13939 (code=exited, status=1/FAILURE)

5月 11 20:53:05 centos-minion dockerd-current[13939]: --tlscert string                        Path to TLS certificate file (default "/etc/docker/cert.pem")
5月 11 20:53:05 centos-minion dockerd-current[13939]: --tlskey string                         Path to TLS key file (default "/etc/docker/key.pem")
5月 11 20:53:05 centos-minion dockerd-current[13939]: --tlsverify                             Use TLS and verify the remote
5月 11 20:53:05 centos-minion dockerd-current[13939]: --userland-proxy                        Use userland proxy for loopback traffic (default true)
5月 11 20:53:05 centos-minion dockerd-current[13939]: --userland-proxy-path string            Path to the userland proxy binary
5月 11 20:53:05 centos-minion dockerd-current[13939]: --userns-remap string                   User/Group setting for user namespaces
5月 11 20:53:05 centos-minion dockerd-current[13939]: -v, --version                               Print version information and quit
5月 11 20:53:05 centos-minion dockerd-current[13939]: Run 'dockerd COMMAND --help' for more information on a command.
5月 11 20:53:05 centos-minion dockerd-current[13939]: , Code: 125
5月 11 20:53:05 centos-minion systemd[1]: docker.service failed.

這就是一個比較難搞的問題了,沒有太具體的報錯。從執行命令看應該是docker的配置參數有問題。
我們把這個命令挖出來/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

去/etc/sysconfig/docker*文件裏面找參數,補充完整後收到執行看會報什麼錯誤(若配置文件沒有這個參數或者配置爲空,命命令上這個參數也就不需要加了)。

[root@centos-minion ~]# /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-false --log-driver=journald --signature-verification=false  --storage-driver overlay2  
Status: unknown flag: --selinux-false
See 'dockerd --help'.

Usage:	dockerd COMMAND

A self-sufficient runtime for containers.

這樣就找到問題了,提示“unknown flag: --selinux-false”
打開/etc/sysconfig/docker文件一看原來是配置參數修改錯了,改回再重啓docker正常了。
剛發也適用同樣現象未表露報錯的問題。

歡迎查閱《centos部署k8s搭建kubernetes集羣》
https://blog.csdn.net/qq_23598037/article/details/90116334

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章