7
votes

I tried to install docker 1.8.2 on Centos7. The docs don't tell anything about versioning. Someone who can help me? I tried

wget -qO- https://get.docker.com/ | sed 's/lxc-docker/lxc-docker-1.8.2/' | sh
+ sh -c 'sleep 3; yum -y -q install docker-engine'

but didn't work.

EDIT: I performed: yum install -y http://yum.dockerproject.org/repo/main/centos/7/Packages/docker-engine-1.8.2-1.el7.centos.x86_64.rpm

That works but I miss options as docker-storage-setup and docker-fetch

5
The docker-storage-setup command is part of the Red Hat (/CentOS/Fedora) package, not part of the upstream source, so you'll only get that if you install a package from your distribution. This is also true for docker-fetch.larsks
Is this a duplicate of unix.stackexchange.com/q/151689/174496 ?SiKing

5 Answers

18
votes

So you can use this command to check which versions are in the yum repo:

sudo yum list docker-engine.x86_64 --showduplicates | sort -r

and then use this to install the version listed that you want:

sudo yum -y install docker-engine-<VERSION_STRING>

If you simply want to downgrade the docker package (this can be performed multiple times, by the way), you'd do this:

sudo yum downgrade docker-engine

and that will install the previous version of docker to the one you currently have installed while cleaning up the later version.

You could always keep downgrading until you got the one you want, but that's annoying, so I'd just go with the first method :P

13
votes

An update for Brittany's Answer As of Apr 2018 the package has been renamed to "docker-ce" (and docker-ee respectively if you're using docker enterprise version), so the commands are now:

check versions:

sudo yum list docker-ce.x86_64 --showduplicates | sort -r

install specific version:

sudo yum install docker-ce-<VERSION_STRING>

Or if you already installed the latest version, use downgrade:

sudo yum downgrade docker-ce-<VERSION_STRING>
3
votes

List and install package(s)

sudo yum list docker-ce --showduplicates | sort -r
sudo yum install docker-ce-<VERSION_STRING>

Remove previous installation

sudo yum remove docker-ce docker-ce-cli
3
votes

Docker Installation of specific version

# yum update

# yum install yum-utils device-mapper-persistent-data lvm2

# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

# yum list docker-ce --showduplicates | sort -r

# yum install docker-ce-<version-string_from_output_of_above_command> 
  OR
# yum install docker-ce
(Above command will install latest version of Docker)

# systemctl start docker

Docker Upgradation to specific version

If you have Docker already installed and you want to upgrade it to specific version, follow below steps:

# sudo yum list docker-ce --showduplicates | sort -r

# yum install docker-ce-<version-string_from_output_of_above_command>

# systemctl start docker
1
votes

Installing specific or old version of Docker on Centos8\REDHAT or later versions:

If docker is running first stop it so we don't have corrupted files later

sudo systemctl stop docker

Then Remove the previously installed version of Docker

 sudo yum remove -y docker-ce docker-ce-cli

Now list the available Docker Engine versions in the repo

[cloud_user@info2c ~]$ yum list docker-ce --showduplicates | sort -r
docker-ce.x86_64                3:20.10.2-3.el8                 docker-ce-stable
docker-ce.x86_64                3:20.10.1-3.el8                 docker-ce-stable
docker-ce.x86_64                3:20.10.0-3.el8                 docker-ce-stable
docker-ce.x86_64                3:19.03.14-3.el8                docker-ce-stable
docker-ce.x86_64                3:19.03.13-3.el8                docker-ce-stable

To install specific version here is command

$ sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io

In our case command would be like this

[cloud_user@info2c ~]$  sudo yum install docker-ce-3:19.03.13-3.el8  docker-ce-cli-3:19.03.13-3.el8
[sudo] password for cloud_user: 
Last metadata expiration check: 0:09:37 ago on Sat 23 Jan 2021 05:18:06 PM UTC.
Dependencies resolved.
================================================================================================================================================================================================================================================
 Package                                                   Architecture                                       Version                                                        Repository                                                    Size
================================================================================================================================================================================================================================================
Installing:
 docker-ce                                                 x86_64                                             3:19.03.13-3.el8                                               docker-ce-stable                                              24 M
Installing dependencies:
 docker-ce-cli                                             x86_64                                             1:20.10.2-3.el8                                                docker-ce-stable                                              33 M
 libcgroup                                                 x86_64                                             0.41-19.el8                                                    baseos                                                        70 k

Transaction Summary
================================================================================================================================================================================================================================================
Install  3 Packages