Este artículo explica cómo instalar Docker en una estación de trabajo Debian, Ubuntu o Devuan.

Actualizar el sistema:

# sudo su
# apt-get update && apt-get upgrade && apt-get dist-upgrade && apt-get autoremove && apt-get autoclean

Instalar la clave GPG del repositorio de Docker:

# curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Configurar el repositorio (en Debian):

# echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" |\
  tee /etc/apt/sources.list.d/docker.list

Configurar el repositorio (en Ubuntu):

# echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" |\
  tee /etc/apt/sources.list.d/docker.list

Configurar el repositorio (en Devuan Beowulf):

# echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian buster stable" |\
  tee /etc/apt/sources.list.d/docker.list

Actualizar la base de paquetes:

# apt-get update

Instalar Docker:

# apt-get install docker-ce docker-ce-cli containerd.io

Como tip interesante, es posible listar todas las versiones disponibles de Docker con el siguiente comando (si se desea o necesita instalar una versión particular):

root@vaio:~# apt-cache madison docker-ce
 docker-ce | 5:20.10.6~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:20.10.5~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:20.10.4~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:20.10.3~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:20.10.2~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:20.10.1~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:20.10.0~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:19.03.15~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:19.03.14~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:19.03.13~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:19.03.12~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:19.03.11~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:19.03.10~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:19.03.9~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:19.03.8~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:19.03.7~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:19.03.6~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:19.03.5~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:19.03.4~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:19.03.3~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:19.03.2~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:19.03.1~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:19.03.0~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:18.09.9~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:18.09.8~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:18.09.7~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:18.09.6~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:18.09.5~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:18.09.4~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:18.09.3~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:18.09.2~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:18.09.1~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 5:18.09.0~3-0~debian-buster | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 18.06.3~ce~3-0~debian | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 18.06.2~ce~3-0~debian | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 18.06.1~ce~3-0~debian | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 18.06.0~ce~3-0~debian | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 18.03.1~ce-0~debian | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 18.03.0~ce-0~debian | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 17.12.1~ce-0~debian | https://download.docker.com/linux/debian buster/stable amd64 Packages
 docker-ce | 17.12.0~ce-0~debian | https://download.docker.com/linux/debian buster/stable amd64 Packages

Agregar a nuestro usuario al grupo "docker":

# usermod -a -G docker emi

En sistemas de escritorio es necesario reiniciar sesión para reflejar el cambio de grupo en el usuario no privilegiado. Sino, abrir una nueva sesión con su:

emi@vaio:~$ su - emi
Password: 
emi@vaio:~$ 

Verificar el funcionamiento de Docker:

emi@vaio:~$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete 
Digest: sha256:f2266cbfc127c960fd30e76b7c792dc23b588c0db76233517e1891a4e357d519
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/

Referencias

Compartí este artículo