问题
For some time, the docker-io
package has been used to install Docker on CentOS 6.
Since early this month, this package no longer appears to be available:
[root@e0-01.p:0 yum.repos.d]# yum install docker-io
Loaded plugins: fastestmirror, presto
Setting up Install Process
Determining fastest mirrors
* base: mirror.intergrid.com.au
* extras: mirror.ventraip.net.au
* updates: mirror.ventraip.net.au
base | 3.7 kB 00:00
base/primary_db | 4.7 MB 00:00
epel | 4.7 kB 00:00
epel/primary_db | 6.0 MB 00:00
extras | 3.4 kB 00:00
extras/primary_db | 28 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 3.2 MB 00:00
No package docker-io available.
Error: Nothing to do
docker-io
was previously part of the epel repository and has been the recommended way to install Docker (albeit, an older version) on CentOS 6 in a number of places.
Is there any other way Docker can be installed on CentOS 6?
回答1:
This version finally installed OK
wget https://yum.dockerproject.org/repo/main/centos/6/Packages/docker-engine-1.7.1-1.el6.x86_64.rpm
sudo rpm -ivhf docker-engine-1.7.1-1.el6.x86_64.rpm
sudo service docker start
System
Linux host.my-domain.com 2.6.32-431.17.1.el6.x86_64 #1 SMP Wed May 7 23:32:49 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
回答2:
I'm not sure why docker-io
suddenly disappeared, but the same version previously available through the epel repository can be installed directly from this rpm hosted by Docker:
[root@server]# yum install
https://get.docker.com/rpm/1.7.1/centos-6/RPMS/x86_64/docker-engine-1.7.1-1.el6.x86_64.rpm
[root@server]# docker --version
Docker version 1.7.0, build 0baf609
回答3:
You should install docker-engine from epel-release:
- Add docker repository for installing latest copy of Docker for Centos 6
Update, install epel repo then create a repo called docker.repo and fill in the information for docker repo:
[user@docker7 ~]# sudo yum update -y
[user@docker7 ~]# sudo yum install epel-release
[user@docker7 ~]# sudo vi /etc/yum.repos.d/docker.repo
[docker-repo]
name=Docker Repo
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
- Install docker package, then enable the service to start upon reboot, also start the docker service.
Now install docker-engine and enable docker to start at boot with systemctl. Then enable docker command and also start docker with systemctl start docker
For centos 7
[user@docker7 ~]$ sudo yum install -y docker-engine
[user@docker7 ~]$ sudo systemctl enable docker
[user@docker7 ~]$ sudo systemctl start docker
[user@docker7 ~]$ sudo systemctl status docker
For centos 6
[user@docker7 ~]$ sudo chkconfig docker on
[user@docker7 ~]$ sudo service docker start
[user@docker7 ~]$ sudo service docker status
[user@docker7 ~]$ ps aux | grep docker
root 2382 0.3 1.4 498424 26536 ? Ssl 20:17 0:00 /usr/bin/dockerd
root 2385 0.0 0.2 263104 5568 ? Ssl 20:17 0:00 docker-containerd -l unix:///var/run/docker/libcontainerd/docker-containerd.sock --metrics-interval=0 --start-timeout 2m --state-dir /var/run/docker/libcontainerd/containerd --shim docker-containerd-shim --runtime docker-runc
3.Manage Docker as a non-root user
回答4:
Version 1.7.0 has a bug, preventing the docker daemon from starting on CentOS 6.x:
level=warning msg="Running modprobe bridge nf_nat failed with message: , error: exit status 1"
level=fatal msg="Error starting daemon: Error initializing network controller: Error creating default \"bridge\" network: operation not supported"
In order to fix use version 1.7.1:
yum install https://yum.dockerproject.org/repo/main/centos/6/Packages/docker-engine-1.7.1-1.el6.x86_64.rpm
来源:https://stackoverflow.com/questions/55134196/installing-docker-on-centos-6-after-removal-of-docker-io