Prerequisites
- A machine running Ubuntu 16.04 or newer (this example uses Ubuntu 18.04 “Bionic Beaver” on
x86_64). - A user account with
sudoprivileges.
Make sure your system is up to date before proceeding. Run
sudo apt-get update && sudo apt-get upgrade if you haven’t recently updated your packages.1. Remove Old Docker Versions
If you have any legacy Docker packages installed, remove them to avoid conflicts:2. Install Required Packages
Docker’s repository requires HTTPS transport, certificate management, and command-line tools. Update the package index and install these dependencies:Prerequisite Packages
| Package | Purpose |
|---|---|
| apt-transport-https | Allows apt to use repositories over HTTPS |
| ca-certificates | Provides SSL certificates for HTTPS |
| curl | Downloads files from the command line |
| gnupg-agent | Manages OpenPGP keys |
| software-properties-common | Adds and manages apt repositories |
3. Add Docker’s Official GPG Key
Import Docker’s GPG key to verify package signatures:If the fingerprint does not match
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, do not continue. Verify your network and retry the key import.4. Set Up the Docker APT Repository
Add Docker’s stable repository to your system:5. Install Docker Engine
Refresh the package index and install Docker Engine, CLI, and containerd:6. Verify the Installation
-
List installed Docker packages:
-
Check that the Docker service is active and enabled at boot:
7. View Docker Version and System Information
-
Display the Docker client version:
-
Show detailed version information for both client and server:
-
Inspect system-wide Docker details (containers, images, drivers, plugins):