错误
连接成功
Last login: Sat Aug 29 03:40:10 2020
[root@localhost ~]# sudo systemctl restart 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 六 2020-08-29 03:42:57 PDT; 1min 31s ago
Docs: http://docs.docker.com
Process: 8371 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: 8371 (code=exited, status=1/FAILURE)
8月 29 03:42:57 localhost.localdomain systemd[1]: Starting Docker Application Container Engine...
8月 29 03:42:57 localhost.localdomain dockerd-current[8371]: unable to configure the Docker daemon with file /etc/docker/daemon.json: EOF
8月 29 03:42:57 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
8月 29 03:42:57 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
8月 29 03:42:57 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
8月 29 03:42:57 localhost.localdomain systemd[1]: docker.service failed.
可以看到提示说, 守护进程启动失败, 原因是 /etc/docker/daemon.json 这个文件EOF 也就是空的!!! 这个就是我们错误的原因所在!!!1
解决
添加 内容 vim /etc/docker/daemon.json
vim /etc/docker/daemon.json
启动docker
[root@localhost ~]# sudo systemctl restart docker
查看版本
[root@localhost ~]# docker version
Client:
Version: 1.13.1
API version: 1.26
Package version: docker-1.13.1-162.git64e9980.el7.centos.x86_64
Go version: go1.10.3
Git commit: 64e9980/1.13.1
Built: Wed Jul 1 14:56:42 2020
OS/Arch: linux/amd64
Server:
Version: 1.13.1
API version: 1.26 (minimum version 1.12)
Package version: docker-1.13.1-162.git64e9980.el7.centos.x86_64
Go version: go1.10.3
Git commit: 64e9980/1.13.1
Built: Wed Jul 1 14:56:42 2020
OS/Arch: linux/amd64
Experimental: false
[root@localhost ~]#