How to Install Docker on Ubuntu VPS (2026 Complete Guide)

Docker is one of the most popular container platforms for developers, DevOps engineers, and businesses. It allows you to deploy applications quickly, isolate services, and simplify software management on your VPS.

In this guide, you'll learn how to install Docker on an Ubuntu VPS in just a few minutes.

Requirements

  • Ubuntu 22.04 or Ubuntu 24.04 VPS
  • Root access or a user with sudo privileges
  • Internet connection

Step 1: Update Your System

Before installing Docker, update all installed packages:

sudo apt update
sudo apt upgrade -y

Step 2: Install Required Packages

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

Step 3: Add Docker's Official GPG Key

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

Step 4: Add Docker Repository

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

Step 5: Install Docker Engine

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

Step 6: Verify Docker Installation

docker --version

You should see output similar to:

Docker version 28.x.x

Step 7: Test Docker

sudo docker run hello-world

If Docker is installed correctly, a welcome message will appear.

Optional: Run Docker Without sudo

sudo usermod -aG docker $USER
newgrp docker

Now you can execute Docker commands without using sudo.

Useful Docker Commands

docker ps
docker images
docker pull nginx
docker run -d -p 80:80 nginx
docker stop CONTAINER_ID
docker rm CONTAINER_ID

Security Tips

  • Keep Ubuntu updated regularly.
  • Only expose required ports.
  • Use UFW or another firewall.
  • Avoid running unnecessary containers as root.
  • Keep Docker Engine updated.

Why Use Docker on a VPS?

  • Fast application deployment
  • Lightweight compared to virtual machines
  • Easy scaling
  • Ideal for web hosting and APIs
  • Supports CI/CD workflows
  • Perfect for development and production environments

Need a Reliable Docker VPS?

Docker performs best on a VPS with NVMe SSD storage, dedicated resources, full root access, and a stable network connection. VPS For Life offers Linux VPS hosting optimized for Docker, containers, web applications, APIs, and development environments with fast deployment and worldwide locations.

  • Docker
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Set Up a VPS for Bulk Email Sending

Sending bulk emails requires a properly configured VPS to ensure good deliverability and avoid...

Essential DNS Records for VPS Email Marketing

Setting up proper DNS records is critical for successful email marketing. Here are the essential...

Best Practices for VPS Email Marketing Campaigns

To succeed in email marketing with your VPS, follow these best practices: Use double...

How to Warm Up Your IP Address for Bulk Email

Before sending large volumes of email, it’s important to warm up your IP address. Here’s how to...

How to Avoid Spam Filters When Sending Bulk Emails

Spam filters can block your marketing emails. Here’s how to avoid them and improve your delivery...