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
