How to install docker on Ubuntu 19.04
Hey! If you want to install Docker on Ubuntu 19.04, you need to use the “nightly” build of Docker. If you try the “stable” repo, it just won’t work, because Ubuntu 19 is not supported yet on Docker.
So, I used the steps found in the official documentation: Get Docker CE for Ubuntu. CE stands for “Community Edition”, as there is a Docker Enterprise edition as well (that’s the paid one).
1.- Check your OS version
So, just to be sure of my OS version, I printed the content of the /etc/os-release file:
luis@starseedstation:~$ cat /etc/os-release
NAME=”Ubuntu”
VERSION=”19.04 (Disco Dingo)”
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME=”Ubuntu 19.04"
VERSION_ID=”19.04"
HOME_URL=”https://www.ubuntu.com/"
SUPPORT_URL=”https://help.ubuntu.com/"
BUG_REPORT_URL=”https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL=”https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=disco
UBUNTU_CODENAME=disco
If you just want to print the name of your distro, you can use the lsb_release command, as follows:
luis@starseedstation:~$ lsb_release -cs
disco
2.- Check if any docker version is already installed
Before going forward, we’ll check if any docker version has been installed:
sudo apt-get remove docker docker-engine docker.io containerd runc
3.- Setup the “nightly” repo
i.- Update the index package first:
luis@starseedstation:~$ sudo apt-get update
[sudo] contraseña para luis:
Obj:1 https://repo.skype.com/deb stable InRelease
Ign:2 http://dl.google.com/linux/chrome/deb stable InRelease
Obj:3 http://archive.ubuntu.com/ubuntu disco InRelease
Obj:4 http://dl.google.com/linux/chrome/deb stable Release
Obj:5 http://ppa.launchpad.net/ansible/ansible/ubuntu disco InRelease
Obj:6 https://download.docker.com/linux/ubuntu disco InRelease
Des:7 http://archive.ubuntu.com/ubuntu disco-updates InRelease [97,5 kB]
Des:9 http://archive.ubuntu.com/ubuntu disco-backports InRelease [88,8 kB]
Des:10 http://archive.ubuntu.com/ubuntu disco-security InRelease [97,5 kB]
Descargados 284 kB en 2s (145 kB/s)
Leyendo lista de paquetes… Hecho
ii.- Install some packages to allow apt to use a repo over https:
luis@starseedstation:~$ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
Leyendo lista de paquetes… Hecho
Creando árbol de dependencias
Leyendo la información de estado… Hecho
ca-certificates ya está en su versión más reciente (20190110).
software-properties-common ya está en su versión más reciente (0.97.11).
gnupg-agent ya está en su versión más reciente (2.2.12–1ubuntu3).
curl ya está en su versión más reciente (7.64.0–2ubuntu1.1).
apt-transport-https ya está en su versión más reciente (1.8.1).
0 actualizados, 0 nuevos se instalarán, 0 para eliminar y 1 no actualizados.
Well, these packages were already installed on my system!
iii.- Add the Docker’s official GPG key:
luis@starseedstation:~$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add —
OK
==> Check if the last line says “OK”.
iv.- Check if your system have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88. For doing this, you need to search for the last 8 characters of the fingerprint.
luis@starseedstation:~$ sudo apt-key fingerprint 0EBFCD88
pub rsa4096 2017–02–22 [SCEA]
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [desconocida] Docker Release (CE deb) <docker@docker.com>
sub rsa4096 2017–02–22 [S]
==> Look at the end of the “pub” line.
v.- Now setup the “nightly” repo, so you can have docker on your non-supported distro for the “stable” one:
luis@starseedstation:~$ sudo add-apt-repository \
> “deb [arch=amd64] https://download.docker.com/linux/ubuntu \
> $(lsb_release -cs) \
> nightly”
Obj:1 https://repo.skype.com/deb stable InRelease
Ign:2 http://dl.google.com/linux/chrome/deb stable InRelease
Obj:3 http://ppa.launchpad.net/ansible/ansible/ubuntu disco InRelease
Obj:4 https://download.docker.com/linux/ubuntu disco InRelease
Obj:5 http://archive.ubuntu.com/ubuntu disco InRelease
Obj:6 http://dl.google.com/linux/chrome/deb stable Release
Des:7 http://archive.ubuntu.com/ubuntu disco-updates InRelease [97,5 kB]
Des:8 https://download.docker.com/linux/ubuntu disco/nightly amd64 Packages [33,5 kB]
Des:10 http://archive.ubuntu.com/ubuntu disco-backports InRelease [88,8 kB]
Des:11 http://archive.ubuntu.com/ubuntu disco-security InRelease [97,5 kB]
Descargados 317 kB en 2s (142 kB/s)
Leyendo lista de paquetes… Hecho
vi.- Update the apt index again, so it can get the new packages:
luis@starseedstation:~$ sudo apt-get update
Obj:1 https://repo.skype.com/deb stable InRelease
Obj:2 http://ppa.launchpad.net/ansible/ansible/ubuntu disco InRelease
Ign:3 http://dl.google.com/linux/chrome/deb stable InRelease
Obj:4 http://archive.ubuntu.com/ubuntu disco InRelease
Obj:5 https://download.docker.com/linux/ubuntu disco InRelease
Obj:6 http://dl.google.com/linux/chrome/deb stable Release
Des:7 http://archive.ubuntu.com/ubuntu disco-updates InRelease [97,5 kB]
Des:9 http://archive.ubuntu.com/ubuntu disco-backports InRelease [88,8 kB]
Des:10 http://archive.ubuntu.com/ubuntu disco-security InRelease [97,5 kB]
Descargados 284 kB en 2s (142 kB/s)
Leyendo lista de paquetes… Hecho
4.- Install the packages, finally!
luis@starseedstation:~$ sudo apt-get install docker-ce docker-ce-cli containerd.io
Leyendo lista de paquetes… Hecho
Creando árbol de dependencias
Leyendo la información de estado… Hecho
Se instalarán los siguientes paquetes adicionales:
aufs-tools cgroupfs-mount pigz
Se instalarán los siguientes paquetes NUEVOS:
aufs-tools cgroupfs-mount containerd.io docker-ce docker-ce-cli pigz
0 actualizados, 6 nuevos se instalarán, 0 para eliminar y 1 no actualizados.
Se necesita descargar 88,1 MB de archivos.
Se utilizarán 390 MB de espacio de disco adicional después de esta operación.
W: Sources disagree on hashes for supposely identical version ‘1.2.6–3’ of ‘containerd.io:amd64’.
¿Desea continuar? [S/n] s
Des:1 http://archive.ubuntu.com/ubuntu disco/universe amd64 pigz amd64 2.4–1 [57,4 kB]
Des:2 https://download.docker.com/linux/ubuntu disco/nightly amd64 containerd.io amd64 1.2.6–3 [22,6 MB]
Des:3 http://archive.ubuntu.com/ubuntu disco/universe amd64 aufs-tools amd64 1:4.9+20170918–2 [104 kB]
Des:4 http://archive.ubuntu.com/ubuntu disco/universe amd64 cgroupfs-mount all 1.4 [6.320 B]
Des:5 https://download.docker.com/linux/ubuntu disco/nightly amd64 docker-ce-cli amd64 5:0.0.0–20190719010106–7606ffb315–0~ubunt
u-disco [42,5 MB]
Des:6 https://download.docker.com/linux/ubuntu disco/nightly amd64 docker-ce amd64 5:0.0.0–20190719010106–7606ffb315–0~ubuntu-di
sco [22,8 MB]
Descargados 88,1 MB en 51s (1.732 kB/s)
Seleccionando el paquete pigz previamente no seleccionado.
(Leyendo la base de datos … 296286 ficheros o directorios instalados actualmente.)
Preparando para desempaquetar …/0-pigz_2.4–1_amd64.deb …
Desempaquetando pigz (2.4–1) …
Seleccionando el paquete aufs-tools previamente no seleccionado.
Preparando para desempaquetar …/1-aufs-tools_1%3a4.9+20170918–2_amd64.deb …
Desempaquetando aufs-tools (1:4.9+20170918–2) …
Seleccionando el paquete cgroupfs-mount previamente no seleccionado.
Preparando para desempaquetar …/2-cgroupfs-mount_1.4_all.deb …
Desempaquetando cgroupfs-mount (1.4) …
Seleccionando el paquete containerd.io previamente no seleccionado.
Preparando para desempaquetar …/3-containerd.io_1.2.6–3_amd64.deb …
Desempaquetando containerd.io (1.2.6–3) …
Seleccionando el paquete docker-ce-cli previamente no seleccionado.
Preparando para desempaquetar …/4-docker-ce-cli_5%3a0.0.0–20190719010106–7606ffb315–0~ubuntu-disco_amd64.deb …
Desempaquetando docker-ce-cli (5:0.0.0–20190719010106–7606ffb315–0~ubuntu-disco) …
Seleccionando el paquete docker-ce previamente no seleccionado.
Preparando para desempaquetar …/5-docker-ce_5%3a0.0.0–20190719010106–7606ffb315–0~ubuntu-disco_amd64.deb …
Desempaquetando docker-ce (5:0.0.0–20190719010106–7606ffb315–0~ubuntu-disco) …
Configurando aufs-tools (1:4.9+20170918–2) …
Configurando containerd.io (1.2.6–3) …
Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /lib/systemd/system/containerd.service.
Configurando docker-ce-cli (5:0.0.0–20190719010106–7606ffb315–0~ubuntu-disco) …
Configurando pigz (2.4–1) …
Configurando cgroupfs-mount (1.4) …
Configurando docker-ce (5:0.0.0–20190719010106–7606ffb315–0~ubuntu-disco) …
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
Procesando disparadores para systemd (240–6ubuntu5.2) …
Procesando disparadores para man-db (2.8.5–2) …
Procesando disparadores para libc-bin (2.29–0ubuntu2) …
5.- Check the installation
We are gonna do this by running a test image, which is going to be downloaded first. Then it will run and print a message.
luis@starseedstation:~$ sudo docker run hello-world
[sudo] contraseña para luis:
Unable to find image ‘hello-world:latest’ locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:6540fc08ee6e6b7b63468dc3317e3303aae178cb8a45ed3123180328bcc1d20f
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the “hello-world” image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
Oh, my, we are ready to roll! :D