Skip to main content
In this lesson you’ll install Docker Engine on an Ubuntu VM and verify the installation by running the official hello-world container. This guide follows the official Docker Engine installation flow for Ubuntu. Keep a browser open to the Docker documentation for reference: https://docs.docker.com/engine/install/ubuntu/

Prerequisites

1 — Verify OS release and architecture

Confirm the distribution and version:
Example output from this VM:
Confirm the system architecture is 64-bit:
Example output:

2 — Uninstall old Docker packages (optional / precaution)

If older Docker packages are installed, remove them first. On production systems take care — removing packages may impact running services.
If this VM runs production services, do NOT remove packages unless you understand the consequences. Back up important data and confirm dependencies before uninstalling packages.
A conservative removal command (adjust package names if needed):
You can inspect installed Docker-related packages first:
Follow these steps to configure the official Docker repository, which ensures you get the latest stable Docker packages.
  1. Update apt and install prerequisites:
  1. Create the keyrings directory and install Docker’s GPG key:
  1. Add the Docker APT repository, using the system architecture and Ubuntu codename dynamically:
Update apt and install Docker Engine, the CLI, containerd, and the Buildx / Compose plugins:
Packages installed typically include: Confirm installation prompts during apt and accept (Y) if required.

5 — Enable and start Docker

Enable Docker to start automatically at boot and start the service immediately:
Check Docker service status:
You should see output similar to:

6 — Verify the installation: run hello-world

Pull and run the hello-world image to confirm Docker can download images and run containers:
Expected (abbreviated) output:

Post-installation tips

  • To run Docker commands without sudo, create the docker group and add your user:
If you add your user to the docker group, understand the security implications: members of the docker group effectively have root-equivalent access to the host. See Docker’s post-installation docs for details.
  • For Compose and Buildx usage, refer to the Docker docs for examples and plugin configuration.
  • If you have specialized firewall rules (iptables/nftables), verify Docker’s networking behavior and adjust rules to avoid conflicts.
This completes the Docker Engine installation and verification on Ubuntu.

Watch Video