Docker: Instalar en Ubuntu 20.04 LTS
Hoy os voy a explicar como instalar Docker en una máquina Ubuntu.
Como vais a ver no es muy complicado lanzar la instalación. Empezamos:
1 |
sudo apt update |
Instalamos dependencias:
1 |
sudo apt install apt-transport-https ca-certificates curl software-properties-common |
Agregamos la apt-key:
1 2 |
root@ubuntu:~# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - OK |
Agregamos el repositorio necesario:
1 |
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" |
Actualizamos:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
root@ubuntu:~# sudo apt update Obj:1 http://security.ubuntu.com/ubuntu focal-security InRelease Obj:2 https://download.docker.com/linux/ubuntu focal InRelease Obj:3 http://us.archive.ubuntu.com/ubuntu focal InRelease Obj:4 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease Obj:5 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease Leyendo lista de paquetes... Hecho Creando árbol de dependencias Leyendo la información de estado... Hecho Se puede actualizar 1 paquete. Ejecute «apt list --upgradable» para verlo. |
Lanzamos el comando para limpiar la caché:
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
root@ubuntu:~# apt-cache policy docker-ce docker-ce: Instalados: (ninguno) Candidato: 5:20.10.2~3-0~ubuntu-focal Tabla de versión: 5:20.10.2~3-0~ubuntu-focal 500 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages 5:20.10.1~3-0~ubuntu-focal 500 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages 5:20.10.0~3-0~ubuntu-focal 500 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages 5:19.03.14~3-0~ubuntu-focal 500 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages 5:19.03.13~3-0~ubuntu-focal 500 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages 5:19.03.12~3-0~ubuntu-focal 500 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages 5:19.03.11~3-0~ubuntu-focal 500 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages 5:19.03.10~3-0~ubuntu-focal 500 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages 5:19.03.9~3-0~ubuntu-focal 500 500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages |
Hacemos la instalación:
1 |
sudo apt install docker-ce |
Comprobamos el estado del servicio:
1 |
sudo systemctl status docker |
Lanzamos un contenedor básico para comprobar:
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
root@ubuntu:~# docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 0e03bdcc26d7: Pull complete Digest: sha256:1a523af650137b8accdaed439c17d684df61ee4d74feac151b5b337bd29e7eec 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: The Docker client contacted the Docker daemon. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 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/ |
¿Te ha gustado la entrada SÍGUENOS EN TWITTER?
Te ha gustado la entrada SGUENOS EN TWITTER O INVITANOS A UN CAFE?