linux虚拟机中docker安装后启动出现错误

错误提示信息:

[root@localhost ~]# systemctl start docker
Job for docker.service failed because the control process exited with error code. See "syste
mctl status docker.service" and "journalctl -xe" for details.

[root@localhost ~]# systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled
)
   Active: failed (Result: exit-code) since Sun 2020-05-24 00:10:04 EDT; 1min 28s ago
     Docs: http://docs.docker.com
  Process: 5452 ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/do
cker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=system
d --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --init-path=/usr/libexec/do
cker/docker-init-current --seccomp-profile=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE
_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIE
S (code=exited, status=1/FAILURE)
 Main PID: 5452 (code=exited, status=1/FAILURE)

May 24 00:10:01 localhost.localdomain systemd[1]: Starting Docker Application Container.....
May 24 00:10:01 localhost.localdomain dockerd-current[5452]: time="2020-05-24T00:10:01.9..."
May 24 00:10:01 localhost.localdomain dockerd-current[5452]: time="2020-05-24T00:10:01.9..."
May 24 00:10:02 localhost.localdomain dockerd-current[5452]: time="2020-05-24T00:10:02.98...
May 24 00:10:04 localhost.localdomain dockerd-current[5452]: Error starting daemon: SELi...)
May 24 00:10:04 localhost.localdomain systemd[1]: docker.service: main process exited, ...RE
May 24 00:10:04 localhost.localdomain systemd[1]: Failed to start Docker Application Co...e.
May 24 00:10:04 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
May 24 00:10:04 localhost.localdomain systemd[1]: docker.service failed.

[root@localhost ~]# journalctl -xe
May 24 00:16:08 localhost.localdomain systemd[1]: Starting Docker Application Container Engi
-- 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.
May 24 00:16:08 localhost.localdomain dockerd-current[5527]: time="2020-05-24T00:16:08.40991
May 24 00:16:08 localhost.localdomain dockerd-current[5527]: time="2020-05-24T00:16:08.42232
May 24 00:16:09 localhost.localdomain dockerd-current[5527]: time="2020-05-24T00:16:09.44112
May 24 00:16:10 localhost.localdomain dockerd-current[5527]: Error starting daemon: SELinux 
May 24 00:16:10 localhost.localdomain systemd[1]: docker.service: main process exited, code=
May 24 00:16:10 localhost.localdomain systemd[1]: Failed to start Docker Application Contain
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has failed.
-- 
-- The result is failed.
May 24 00:16:10 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
May 24 00:16:10 localhost.localdomain systemd[1]: docker.service failed.
May 24 00:16:10 localhost.localdomain polkitd[745]: Unregistered Authentication Agent for un

解决方法:
修改/etc/sysconfig/docker 文件

[root@localhost sysconfig]# vi docker
[root@localhost sysconfig]# cat docker
# /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'(修改前)
DNS='--selinux-enabled --log-driver=journald --signature-verification=false'(修改后)
if [ -z "${DOCKER_CERT_PATH}" ]; then
    DOCKER_CERT_PATH=/etc/docker
fi

启动docker的常用命令

//重启docker
[root@localhost sysconfig]# systemctl restart docker
//查询版本
[root@localhost sysconfig]# docker -v
Docker version 1.13.1, build 64e9980/1.13.1
//停止docker
[root@localhost sysconfig]# systemctl stop docker
//启动docker
[root@localhost sysconfig]# systemctl start docker

你可能感兴趣的:(docker)