Skip to main content
To install Docker on Ubuntu, follow these steps:

Step 1: Uninstall Old Versions (If Any)

If you have an older version of Docker installed, remove it first:

Step 2: Update Package List

Update the package index and install dependencies:

Step 3: Add Docker’s Official GPG Key

Step 4: Add Docker Repository

Then, update the package list again:

Step 5: Install Docker Engine, CLI, and Containerd

Step 6: Verify Docker Installation

Check if Docker is installed correctly:
Start the Docker service:
Test Docker with a Hello World container:

Step 7: Run Docker Without sudo (Optional)

By default, Docker requires root privileges. To allow your user to run Docker without sudo:
Then, log out and log back in or run:
Now, try running:

Step 8: Enable Docker to Start on Boot

Bonus: Install Docker Compose

Docker Compose allows you to run multi-container applications. Install it using:
Verify installation: