Adding the Docker package repository

Docker is on the official Ubuntu repository, but that version is likely to be out of date. Instead, we will download Docker from Docker's own official repository.

First, let's install the packages that'll ensure apt can use the Docker repository over HTTPS:

$ sudo apt install -y apt-transport-https ca-certificates curl software-properties-common

Then, add Docker's official GPG key. This allows you to verify that the Docker package you have downloaded has not been corrupted:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

The preceding command uses curl to download the GPG key and add it to apt. We can then use apt-key to verify that the key has the fingerprint 9DC8 5822 9FC7 ...

Get Building Enterprise JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.