Instalar Docker en Ubuntu

  • Enviado por: administrador

Instalar Docker en Ubuntu

sudo apt update

Next, install a few prerequisite packages which let apt use packages over HTTPS: sudo apt install apt-transport-https ca-certificates curl software-properties-common

Then add the GPG key for the official Docker repository to your system:

curl -fsSL | sudo apt-key add –

Add the Docker repository to APT sources:

sudo add-apt-repository «deb [arch=amd64] bionic stable»

Next, update the package database with the Docker packages from the newly added repo:

Make sure you are about to install from the Docker repo instead of the default Ubuntu repo:

Notice that docker-ce is not installed, but the candidate for installation is from the Docker repository for Ubuntu 18.04 (bionic).

Finally, install Docker:

Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running:

sudo systemctl status docker

Installing Docker now gives you not just the Docker service (daemon) but also the docker command line utility, or the Docker client. We’ll explore how to use the docker command later in this tutorial.

Paso 2 - Executing the Docker Command Without Sudo (Optional)

By default, the docker command can only be run the root user or by a user in the docker group, which is automatically created during Docker’s installation process. If you attempt to run the docker command without prefixing it with sudo or without being in the docker group, you’ll get an output like this:

docker ps

If you want to avoid typing sudo whenever you run the docker command, add your username to the docker group:

sudo usermod -aG docker ${USER}

To apply the new group membership, log out of the server and back in, or type the following:

su – ${USER}

Confirm that your user is now added to the docker group by typing:

id -nG

If you need to add a user to the docker group that you’re not logged in as, declare that username explicitly using:

sudo usermod -aG docker username

Ya se puede correr el comando Docker con el usuario abarba que es el usuario de este ejemplo

docker ps

Ver información del Docker

Docker info

Docker search Ubuntu

Autor: administrador