-
Notifications
You must be signed in to change notification settings - Fork 1
How to install Docker
In order to guarantee that we obtain the most recent version of Docker, we will install it from the official Docker repository instead of relying on the Docker installation package provided by the official Ubuntu repository. This involves adding a new package source, verifying the validity of the downloads by adding the GPG key from Docker, and finally installing the package.
First, update your existing list of packages:
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 https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Add the Docker repository to APT sources:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
This will also update our package database with the Docker packages from the newly added repo.
Finally, install Docker:
sudo apt install docker-ce
Docker should now be installed, the daemon started, and the process enabled to start on boot.
The docker
command can only be executed by the root
user or a user belonging to the docker group, which is created automatically during Docker's installation. 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 run Docker on macOS, we need to install the Docker Desktop application for macOS, which can be downloaded from here:
https://docs.docker.com/desktop/install/mac-install/