There was a problem loading the comments.

Install Docker Engine on a Linux VPS (Ubuntu/Debian) — GARMTECH guide

Support Portal  »  Knowledgebase  »  Viewing Article

  Print

This guide shows how to install Docker Engine on an Ubuntu or Debian Linux VPS.

Note: these commands require root privileges. Run them as root or with sudo. Always review the commands before executing them on production servers.

Step 1 — Remove conflicting/old packages (if any)

If you previously installed Docker from distribution packages, remove them first:

sudo apt remove -y docker docker-engine docker.io containerd runc

Step 2 — Install prerequisites

sudo apt update
sudo apt install -y ca-certificates curl gnupg

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

Debian: the URL is similar, but uses /linux/debian/gpg instead of /linux/ubuntu/gpg.

Step 4 — Add the Docker repository

Ubuntu:

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

Debian: replace ubuntu with debian in the repository URL.

Step 5 — Install Docker Engine

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

Step 6 — Test the installation

sudo docker run --rm hello-world

Optional — Run Docker without sudo

Docker can be configured to run without sudo by adding your user to the docker group:

sudo usermod -aG docker $USER

Log out and log in again. Security note: users in the docker group effectively have root-level permissions on the server.

Firewall and networking (reminder)

  • Docker publishes ports only if you use -p or a compose port mapping.
  • Allow only the ports you actually need (for example 80/443 for web services).

Share via
Did you find this article useful?  

Related Articles


Comments

Add Comment

Replying to  

Tags

© GARMTECH