Install Latest Docker Engine on Ubuntu

A complete step-by-step guide to installing the latest Docker Engine on Ubuntu using Docker’s official repository. Includes Docker Compose v2 and Buildx.

Amruth L P

Full Stack Developer

Building tools with Astro and Next.js

3 min read 470 words
Install Latest Docker Engine on Ubuntu

Overview

This document explains how to install the latest stable version of Docker Engine on Ubuntu using Docker’s official repository.

Using the official repository ensures:

  • Up‑to‑date packages
  • Verified and secure installations
  • Full support for Docker Engine, Compose v2, and Buildx

Supported Ubuntu Versions

  • Ubuntu 20.04 LTS
  • Ubuntu 22.04 LTS
  • Ubuntu 24.04 LTS

Prerequisites

  • Ubuntu system with sudo access
  • Active internet connection
  • Clean system (recommended for production)

Step 1: Update the System

Before installing Docker, update your system packages to avoid dependency conflicts.

sudo apt update
sudo apt upgrade -y

Step 2: Install Required Dependencies

These packages are required to securely add Docker’s repository and verify packages.

sudo apt install -y ca-certificates curl gnupg lsb-release

Step 3: Add Docker’s Official GPG Key

Docker uses GPG signing to verify the integrity of its packages.

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
  sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

Set proper permissions:

sudo chmod a+r /etc/apt/keyrings/docker.gpg

Step 4: Add Docker Repository (Stable)

Add Docker’s official stable repository for your Ubuntu release.

echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Update the package index:

sudo apt update

Step 5: Install Docker Engine and Tools

Install Docker Engine along with essential tools such as Docker Compose v2 and Buildx.

sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Installed Components

  • Docker Engine (latest stable)
  • Docker CLI
  • Containerd
  • Docker Compose v2
  • Docker Buildx

Step 6: Start and Enable Docker

Enable Docker to start automatically on system boot and start the service immediately.

sudo systemctl enable docker
sudo systemctl start docker

Check service status:

sudo systemctl status docker

Step 7: Verify Installation

Check Docker and Docker Compose versions:

docker --version
docker compose version

Run a test container:

sudo docker run hello-world

If you see:

“Hello from Docker!”

Docker is installed correctly.


Add your user to the Docker group:

sudo usermod -aG docker $USER
newgrp docker

Verify:

docker run hello-world

Docker should now work without sudo.


Useful Paths and Debugging Tips

Docker Data Directory

/var/lib/docker

Docker Configuration File

/etc/docker/daemon.json

Docker Logs

journalctl -u docker

Conclusion

You have successfully installed the latest Docker Engine on Ubuntu using Docker’s official and recommended method.

This setup is suitable for:

  • Development
  • Testing
  • Production workloads

You now have Docker Engine, Docker Compose v2, and Buildx ready to use.

About the Author

Amruth L P

Full Stack Developer

Building tools with Astro and Next.js

Related Articles

Continue exploring topics you might find interesting

devops

Gitea Setup on Debian/Ubuntu (LAN Access, PostgreSQL, Apache)

A step-by-step guide to setting up Gitea on Debian/Ubuntu with LAN access, PostgreSQL, and Apache.

Read Article
database

PostgreSQL 18 Installation & Setup Guide for Debian and Ubuntu

A production-ready, step-by-step guide to installing PostgreSQL 18 on Debian and Ubuntu using the official PostgreSQL APT repository. Covers secure installation, user and database setup, authentication configuration, and best practices for modern web applications.

Read Article
lms

Koha LMS Installation Guide on Linux (Debian/Ubuntu)

This document provides a **clear, step-by-step, production-oriented guide** to install **Koha Integrated Library Management System (LMS)** on a Linux server, specifically **Debian or Ubuntu**. Koha officially recommends Debian-based systems and this guide follows best practices used in real-world library deployments.

Read Article

Enjoyed this article?

Get notified when I publish new content. No spam, just quality articles delivered to your inbox.