Tutorials

Install Docker

Docker lets you run applications in isolated containers, making deployments reproducible and easy to manage. This guide covers installing Docker Engine and Docker Compose on Ubuntu and Debian.

Requirements

  • A VPS running Ubuntu 20.04+ or Debian 11+
  • Root or sudo access
  • At least 1 GB RAM and 10 GB free disk space

1. Connect to Your Server

ssh root@YOUR_SERVER_IP

Or use the web terminal in the Sitequest dashboard.

2. Remove Old Versions

Remove any previously installed Docker packages to avoid conflicts:

apt remove -y docker docker-engine docker.io containerd runc 2>/dev/null

3. Install Dependencies

apt update
apt install -y ca-certificates curl gnupg

4. Add Docker's Official Repository

install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc

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

For Debian, replace ubuntu with debian in the URLs above.

5. Install Docker Engine

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

6. Verify the Installation

docker --version
docker compose version

Run a test container:

docker run --rm hello-world

You should see a message confirming Docker is working correctly.

7. Enable Docker on Boot

Docker is enabled automatically on most systems. Verify with:

systemctl is-enabled docker

If it returns disabled, enable it:

systemctl enable docker

8. (Optional) Run Docker as a Non-Root User

By default only root can run Docker commands. To allow a regular user:

usermod -aG docker YOUR_USERNAME

Log out and back in for the group change to take effect. This avoids using sudo for every Docker command.

Running Your First Application

Create a simple docker-compose.yml to test:

services:
  web:
    image: nginx:alpine
    ports:
      - "80:80"

Start it:

docker compose up -d

Visit http://YOUR_SERVER_IP in your browser to see the Nginx welcome page. Stop it with:

docker compose down

Firewall Considerations

If you have a Sitequest firewall configured, ensure the ports your containers expose are open. Docker manages its own iptables rules, but the Sitequest firewall operates at the network level before traffic reaches your server.

Next Steps