Max Reseller
documentation

How to Install Docker on Ubuntu (Beginner-Friendly Guide with Command Explanations)

MaxReseller

Docker is a powerful tool that allows you to run applications in containers — lightweight, portable, and consistent environments that make development and deployment faster and more efficient. If you’re new to Docker or Linux, this guide is for you.

Let’s get Docker installed on your Ubuntu server step by step, with every command explained so you actually understand what’s happening under the hood.

How to Login MaxReseller ?

How to Setup a Cloud VPS with MaxReseller (Step-by-Step Guide)

🧑‍💻 Step 1: Log In to Your Ubuntu Server

Open PowerShell (on Windows) or Terminal (on Mac/Linux), and connect to your server:

ssh root@your_ip
  • ssh: Secure Shell, used to connect remotely.

  • root@your_ip: Replace your_ip with your actual server IP address. You’ll be logging in as the root user.

  • You’ll be asked to enter the root password.

✅ Once you’re in, you’re ready to start installing Docker.

🧰 Step 2: Update Your Package Index

Before installing anything, update your system so it knows about the latest available software versions:

sudo apt-get update
  • sudo: Executes the command with administrator privileges.

  • apt-get update: Downloads the package lists from repositories and updates your local cache. This ensures you’re installing the latest versions of packages.

🔧 Step 3: Install Required Dependencies

Docker needs some essential tools to be installed first:

sudo apt-get install ca-certificates curl
  • ca-certificates: Keeps your system up-to-date with trusted Certificate Authorities. Needed for secure (HTTPS) connections.

  • curl: A command-line tool to download files from URLs — we’ll use it to grab Docker’s GPG key.

🔐 Step 4: Add Docker’s Official GPG Key

Docker signs their packages to ensure authenticity. To verify those packages, you need Docker’s GPG key:

sudo install -m 0755 -d /etc/apt/keyrings
  • Creates a directory (/etc/apt/keyrings) to securely store GPG keys with correct permissions.

sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
  • Downloads Docker’s GPG key and saves it.

sudo chmod a+r /etc/apt/keyrings/docker.asc
  • Gives read access to all users for the GPG key file. This is required so APT can verify Docker’s packages.

📦 Step 5: Add Docker’s Repository

Now we tell Ubuntu where to look for official Docker packages:

echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  • This command adds Docker’s repository to the list of software sources (/etc/apt/sources.list.d/docker.list).

  • It includes architecture detection and uses the signed key you just downloaded.

🔁 Step 6: Update Again (Now With Docker Repo)

sudo apt-get update

Now your system knows where to find Docker and its latest versions.


🐳 Step 7: Install Docker Engine and Tools

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

Here’s what each package does:

  • docker-ce: The main Docker engine (Community Edition).

  • docker-ce-cli: Command Line Interface to interact with Docker.

  • containerd.io: The core container runtime behind Docker.

  • docker-buildx-plugin: Extended build support for Docker (multi-architecture builds, etc.).

  • docker-compose-plugin: Lets you manage multi-container apps with docker compose command.


✅ Step 8: Verify Docker is Installed

docker --version

That’s it — Docker is installed and ready to go!

MaxReseller

Leave a Comment

Your email address will not be published. Required fields are marked *

Always Available

24/7 Support

Need Expert Assistance? Our team is ready to help you anytime.

Call us at

+91-853-887-7078

WhatsApp Support

Get instant help through WhatsApp. Our experts are just a message away.

Chat with Us