How to Install Docker on Ubuntu 24.04 VPS

Docker is one of the most popular containerization platforms, allowing you to run applications in isolated environments. Installing Docker on your VPS makes it easy to deploy web applications, databases, APIs, and development environments quickly and efficiently.

Requirements

  • Ubuntu 24.04 VPS
  • Root or sudo access
  • SSH connection to your server

Step 1 — Update Your VPS

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 install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

Step 4 — Add the 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 Installation

docker --version

Example output:

Docker version 28.x.x

Step 7 — Start Docker

sudo systemctl enable docker
sudo systemctl start docker

Step 8 — 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

Log out and log back in for the changes to take effect.

Useful Docker Commands

docker ps
docker images
docker pull nginx
docker stop CONTAINER_ID
docker start CONTAINER_ID
docker rm CONTAINER_ID

Conclusion

Your Ubuntu 24.04 VPS is now ready to run Docker containers. Docker simplifies application deployment, improves portability, and is widely used for modern web development, DevOps, and cloud infrastructure.


Related Articles

  • How to Install Docker Compose on Ubuntu VPS
  • How to Secure Your Linux VPS
  • How to Install Nginx on Ubuntu VPS
  • How to Create a New User with Sudo Access
  • How to Connect to Your VPS via SSH
  • ubuntu
  • 0 משתמשים שמצאו מאמר זה מועיל
?האם התשובה שקיבלתם הייתה מועילה

מאמרים קשורים

How to Change Your SSH Port for Better Security

By default, SSH runs on port 22, which is commonly targeted by automated attacks. Changing the...

How to Connect to Your VPS via SSH

SSH (Secure Shell) is a protocol used to securely connect to your VPS. Follow the steps below to...

How to Update and Upgrade Your VPS

Keeping your VPS up to date is essential for security and performance. Here’s how to update and...

How to Check Your VPS Resource Usage

Monitoring your VPS resource usage helps you keep your server performing well. Here’s how you can...

How to Reboot Your VPS Safely

<p>Sometimes, you need to reboot your VPS to apply updates or fix issues. Here’s how to do...