因公司某业务架构的变化,需要使用云微服务,需要使用OpenShift来统筹规划生产服务资源,让服务更好的运作,OpenShift为资源管理,围绕Docker容器打包和Kubernetes容器集群管理的核心构建,在安装docker服务时,碰到如下问题:
安装完Docker后,无法正常启动,通过如下命令查看Docker问题原因:
[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 Mon 2018-09-24 21:00:04 CST; 32s ago
Docs: http://docs.docker.com
Process: 20896 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: 20896 (code=exited, status=1/FAILURE)
Sep 24 21:00:01 localhost.localdomain systemd[1]: Starting Dock...
安装问题,这时通过卸载原来的docker如下:
[root@localhost ~]# yum remove docker-selinux
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
Removed:
container-selinux.noarch 2:2.68-1.el7
Dependency Removed:
docker-client.x86_64 2:1.13.1-74.git6e3bb8e.el7.centos
docker-common.x86_64 2:1.13.1-74.git6e3bb8e.el7.centos
编辑docker.repo,如下:
Complete!
[root@localhost ~]# vi /etc/yum.repos.d/docker.repo
[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
~
保存后,重新安装docker,如下:
[root@localhost ~]# yum install docker-engine
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
base: mirrors.cn99.com
extras: mirrors.cn99.com
updates: mirrors.cn99.com
安装完后,启动docker如下命令:
[root@localhost ~]# service docker start
Redirecting to /bin/systemctl start docker.service
重新查看docker运行状态
[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: active (running) since Mon 2018-09-24 21:55:08 CST; 19min ago
Docs: https://docs.docker.com
Main PID: 22892 (dockerd)
Memory: 56.6M
CGroup: /system.slice/docker.service
├─22892 /usr/bin/dockerd
└─22905 docker-containerd --config /var/run/docker/containerd/containerd.toml