Promotions

Install Docker and Docker Compose on a cloud server

We install the current Docker Engine and Compose plugin from Docker's official repository and start a first app.

Time: 10 min Level: Beginner OS: Ubuntu 24.04 · x86 / ARM64

Requirements

  • A REGTR cloud server (Ubuntu 24.04, x86 or ARM64)
  • A sudo user (see the security guide)

Steps

  1. 1Add the Docker repository

    Add the official GPG key and repository. The command detects the server architecture (amd64/arm64).

    sudo apt update && sudo apt install -y ca-certificates curl
    sudo install -m 0755 -d /etc/apt/keyrings
    sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
    sudo 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" | sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
  2. 2Install Docker Engine and Compose

    Verify with hello-world afterwards.

    sudo apt update
    sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
    sudo docker run --rm hello-world
  3. 3Use Docker without sudo

    Add your user to the docker group; log out and back in to apply.

    sudo usermod -aG docker $USER
    # oturumu kapatıp yeniden aç / log out and back in
    docker ps
  4. 4First compose project

    Run a sample Nginx service with compose.yaml.

    mkdir -p ~/app && cd ~/app
    cat > compose.yaml <<'EOF'
    services:
      web:
        image: nginx:alpine
        ports:
          - "80:80"
        restart: unless-stopped
    EOF
    docker compose up -d
    docker compose ps

Tips

  • Important: ports published by Docker (ports:) bypass UFW and are exposed to the internet. Bind internal services such as databases to "127.0.0.1:5432:5432" or don't publish them at all.
  • On ARM64 servers images must be multi-arch (most official images like nginx, postgres, redis, node are).
  • Keep persistent data in named volumes; server snapshots include them.

FAQ

Which plan is enough for Docker?

A few small services run comfortably on 4 vCPU / 8 GB (ARM 4). For a database plus many containers choose 8 vCPU / 16 GB.

Should I install Docker with snap?

No. The snap package has permission and path differences; the official apt repository is the recommended method.

Updated: 2026-10-23

Reach Sales & Support

Have a question before you buy, or need help with an existing account? Call or email us.

Newsletter Product News in Your Inbox

You're subscribed to our newsletter.