How to install older Docker version (18.06.2) on Ubuntu 18?

11/3/2019

I've been trying for days to install Kubernetes, but it starts already at Docker. I can't seem to find the right version for Docker on Ubuntu. As Kubernetes recommends version 18.06.2 of Docker I followed the steps on Kubernetes at first: Kubernetes installation

Where as I get this error:

E: Version '18.06.2~ce~3-0~ubuntu' for 'docker-ce' was not found

Docker says to list the versions available versions by this command:

apt-cache madison docker-ce

Which gets me this:

root@vmi257369:~# apt-cache madison docker-ce
 docker-ce | 5:19.03.3~3-0~ubuntu-disco | https://download.docker.com/linux/ubuntu disco/stable amd64 Packages
 docker-ce | 5:19.03.2~3-0~ubuntu-disco | https://download.docker.com/linux/ubuntu disco/stable amd64 Packages
 docker-ce | 5:19.03.1~3-0~ubuntu-disco | https://download.docker.com/linux/ubuntu disco/stable amd64 Packages
 docker-ce | 5:19.03.0~3-0~ubuntu-disco | https://download.docker.com/linux/ubuntu disco/stable amd64 Packages

As you can see no 18.06, but only 19 which isn't recommended by Kubernetes.

I've followed this guide of Docker Docker installation, but I can't seem to find the right GPG or what ever is necessary for Docker version 18.

Of course I've tried the post on Stackoverflow as well see here, the result was:

root@vmi257369:~# export VERSION=18.06.1-ce && curl -sSL get.docker.com | sh
# Executing docker install script, commit: f45d7c11389849ff46a6b4d94e0dd1ffebca32c1
Warning: the "docker" command appears to already exist on this system.

If you already have Docker installed, this script can cause trouble, which is
why we're displaying this warning and provide the opportunity to cancel the
installation.

If you installed the current Docker package using this script and are using it
again to update Docker, you can safely ignore this message.

You may press Ctrl+C now to abort this script.
+ sleep 20
+ sh -c apt-get update -qq >/dev/null
+ sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
+ sh -c curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | apt-key add -qq - >/dev/null
Warning: apt-key output should not be parsed (stdout is not a terminal)
+ sh -c echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu disco stable" > /etc/apt/sources.list.d/docker.list
+ sh -c apt-get update -qq >/dev/null
INFO: Searching repository for VERSION '18.06.1-ce'
INFO: apt-cache madison 'docker-ce' | grep '18.06.1.*ce.*-0~ubuntu' | head -1 | awk '{$1=$1};1' | cut -d' ' -f 3

ERROR: '18.06.1-ce' not found amongst apt-cache madison results

Who knows what to do?

On answer By this command

apt-add-repository "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main"

I get this error: Failed to fetch <> 403 Forbidden on IP .... It's on a Contabo server maybe that's the reason?

-- Salomé
docker
installation
kubernetes
ubuntu
version

1 Answer

11/3/2019
sudo -i
curl -fsSL https://apt.dockerproject.org/gpg | apt-key add -
apt-add-repository "deb https://apt.dockerproject.org/repo ubuntu-$(lsb_release -cs) main"
apt-get update -y && apt-get install docker-ce=18.06.2~ce~3-0~ubuntu

OR

sudo -i
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update -y && apt install -y docker-ce=18.06.3~ce~3-0~ubuntu docker-ce-cli=18.06.3~ce~3-0~ubuntu containerd.io
-- fg78nc
Source: StackOverflow