CentOS7 install docker to fix the problem of not starting
- 2020-05-17 07:06:45
- OfStack
CentOS7 could not start the installation of docker. I met this problem at work. I was in a hurry at that time, and I didn't have much information on the Internet
The question!
[root@test ~]# yum update
[root@test ~]# yum install docker
[root@test ~]# service docker start
Redirecting to /bin/systemctl start docker.service
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
[root@test ~]# systemctl status docker.service
low docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: inactive (dead) (Result: exit-code) since 4 2016-03-10 13:01:21 CST; 7s ago
Docs: http://docs.docker.com
Process: 29939 ExecStart=/usr/bin/docker daemon $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY (code=exited, status=2)
Main PID: 29939 (code=exited, status=2)
CGroup: /system.slice/docker.service
└ ─ 29970 mkfs.ext4 -E nodiscard,lazy_itable_init=0,lazy_journal_ini...
test.mayocase.com systemd[1]: Failed to start Docker Applic...
March 10 13:01:20 test.mayocase.com systemd[1]: Unit docker.service entered f...
test.mayocase.com systemd[1]: docker.service failed.
com systemd[1]: docker.service holdoff time o...
Hint: Some lines were ellipsized, use -l to show in full.
[root@test ~]#
After installing yum install docker, it failed to start
[root@apptest ~]# service docker start
Redirecting to /bin/systemctl start docker.service
Stay right where you are
You can install it using the following command and it will succeed.
I have been struggling with one problem for two days. I have tried to shut down the firewall, shut down selinux, reinstalled the system, and so on.
If you have solved the problem, please reply and thank me.
[root@apptest ~]# yum remove docker
[root@apptest ~]# yum remove docker-selinux
[root@test yum.repos.d]# 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
[root@test yum.repos.d]# yum install docker-engine
Installed:
docker-engine.x86_64 0:1.10.2-1.el7.centos
Installed as a dependency:
docker-engine-selinux.noarch 0:1.10.2-1.el7.centos
[root@apptest ~]# service docker start
Redirecting to /bin/systemctl start docker.service
[root@apptest ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
[root@test yum.repos.d]# docker version
Client:
Version: 1.10.2
API version: 1.22
Go version: go1.5.3
Git commit: c3959b1
Built: Mon Feb 22 16:16:33 2016
OS/Arch: linux/amd64
Server:
Version: 1.10.2
API version: 1.22
Go version: go1.5.3
Git commit: c3959b1
Built: Mon Feb 22 16:16:33 2016
OS/Arch: linux/amd64
[root@test yum.repos.d]#
Or use the following method
[root@apptest ~]# curl -fsSL https://get.docker.com/ | sh
+ sh -c 'sleep 3; yum -y -q install docker-engine'
Warning: /var/cache/yum/x86_64/7/docker-main-repo/packages/docker-engine-selinux-1.10.2-1.el7.centos.noarch.rpm: head V4 RSA/SHA512 Signature, The key ID 2c52609d: NOKEY
docker-engine-selinux-1.10.2-1.el7.centos.noarch.rpm Public key has not been installed
The import GPG key 0x2C52609D:
The user ID : "Docker Release Tool (releasedocker) <docker@docker.com>"
The fingerprint : 5811 8e89 f3a9 1289 7c07 0adb f762 2157 2c52 609d
from : https://yum.dockerproject.org/gpg
setsebool: SELinux is disabled.
+ sh -c 'docker version'
Client:
Version: 1.10.2
API version: 1.22
Go version: go1.5.3
Git commit: c3959b1
Built: Mon Feb 22 16:16:33 2016
OS/Arch: linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:
sudo usermod -aG docker your-user
Remember that you will have to log out and back in for this to take effect!
[root@apptest ~]#
[root@apptest ~]# service docker start
Redirecting to /bin/systemctl start docker.service
[root@apptest ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
[root@apptest ~]#
Thank you for reading, I hope to help you, thank you for your support of this site!