Cómo instalar Docker en un equipo con Linux Ubuntu Server 24 usando repositorio apt. Desplegamos el contenedor de prueba «hola mundo» en el Docker Desktop de nuestro equipo Linux Ubuntu Server.
- Preparar entorno y repositorio para instalar Docker Desktop en Linux Ubuntu Server 24.
- Instalar Docker Desktop y Docker Compose en Linux Ubuntu Server 24.
- Desplegar contenedor hello-world en Docker Desktop de Linux Ubuntu Server 24.
Preparar entorno y repositorio para instalar Docker Desktop en Linux Ubuntu Server 24
Ejecutaremos los siguientes comandos para preparar el repositorio de instalación de Docker Desktop. Actualizaremos los repositorios actuales de nuestro equipo Linux Ubuntu con:
1 |
sudo apt-get update |
Instalaremos el certificado necesario con:
1 2 3 4 |
sudo apt-get install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc |
Agregamos el repositorio de Docker a las fuentes apt de nuestro equipo Linux Ubuntu con:
1 2 3 4 |
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null |
Volveremos a actualizar los repositorios de nuestro equipo Linux, ejecutando:
1 |
sudo apt-get update |

Instalar Docker Desktop y Docker Compose en Linux Ubuntu Server 24
Tras preparar el repositorio, como hemos indicado anteriormente, ejecutaremos el siguiente comando para instalar Docker Desktop y Docker Compose:
1 |
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin |

Una vez instalado Docker Desktop, ejecutaremos el siguiente comando para instalar Docker Compose:
1 |
sudo apt install docker-compose |
Desplegar contenedor hello-world en Docker Desktop de Linux Ubuntu Server 24
Para probar nuestro entorno Docker desplegaremos un contenedor de prueba, el típico «hola mundo», ejecutando:
1 |
sudo docker run hello-world |
Si la instalación de Docker ha sido correcta, nos devolverá:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world e6590344b1a5: Pull complete Digest: sha256:e0b569a5163a5e6be84e210a2587e7d447e08f87a0e90798363fa44a0464a1e8 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/ |
