Install Docker on ubuntu server

Table of Contents

Installing Docker on Ubuntu Server: A Step-by-Step Guide

Docker is a powerful platform for developing, shipping, and running applications. In this guide, we’ll walk through the process of installing Docker on an Ubuntu server.

Prerequisites

Before starting, ensure you have:

  • A server running Ubuntu (preferably the latest LTS version)
  • Sudo privileges on the server

Step 1: Update System Packages

Start by updating your package list:

sudo apt update

Optionally, upgrade all your installed packages to their latest versions:

sudo apt upgrade -y

Step 2: Install Required Dependencies

Install packages to allow apt to use a repository over HTTPS:

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

Step 3: Add Docker’s Official GPG Key

Import Docker’s official GPG key:

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

Step 4: Add the Docker Repository

Add the Docker repository to APT sources:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Step 5: Install Docker Engine

Update your package list again:

sudo apt update

Then, install Docker:

sudo apt install docker-ce

Step 6: Start and Automate Docker

Enable and start the Docker service:

sudo systemctl enable docker
sudo systemctl start docker

Step 7: Verify Docker Installation

Check if Docker is running:

sudo docker --version

Conclusion

You’ve successfully installed Docker on your Ubuntu server! You can now begin containerizing applications and taking full advantage of Docker’s capabilities.