Install Docker Engine with Ubuntu on GPU Cloud (2026 Guide) banner image

Install Docker Engine with Container Runtime on Ubuntu (2026 Guide)

Set up Docker Engine and the docker-compose plugin on a fresh Ubuntu 22.04 VM. This guide covers the complete installation process, user permissions configuration, and verification steps to get your container environment ready for development and production workloads.

Docker
Container Runtime
Ubuntu
DevOps
Cloud Infrastructure
⚡ AI Agent Shortcut

Skip the manual steps below. Connect the Massed Compute MCP to your AI assistant and say: “Install Docker Engine on a new Ubuntu VM with 2 vCPU and 2GB RAM”. The agent provisions the VM, runs the installation, configures user permissions, and verifies everything works.

Docker Engine provides the core container runtime for building, shipping, and running applications in lightweight, portable containers. This guide walks through installing Docker Engine, the docker-compose plugin, and essential configuration on Ubuntu 22.04.

We’ll provision a fresh Ubuntu VM, install Docker from the official repository, configure user permissions, and verify the installation with a test container. The entire process takes about 8 minutes from start to finish.

Technology Stack
Component Version Purpose
Ubuntu Server 22.04 LTS Base operating system
Docker Engine Latest (CE) Container runtime
Docker Compose Plugin v2 Multi-container orchestration
Containerd Latest Container lifecycle management
Docker Buildx Latest Extended build capabilities
System Requirements
Resource Minimum Recommended
vCPU 2 cores 4 cores
RAM 2GB 4GB
Storage 20GB 40GB SSD
OS Ubuntu 22.04 Ubuntu 22.04 LTS
Network SSH access SSH + HTTP/HTTPS

Massed Compute VM Pricing

Based on the requirements above (2+ vCPU, 2GB+ RAM, Ubuntu 22.04), here are the matching VM options:

Live Pricing: No matching SKU rows were found in our current inventory. Please check live pricing for the most up-to-date VM options and rates. Pricing was last fetched on June 12, 2026.

Step-by-Step Docker Installation

1

Launch Ubuntu VM

Create a fresh Ubuntu 22.04 VM with at least 2 vCPU and 2GB RAM. Ensure SSH key authentication is configured during launch.

curl -X POST "https://massedcompute.com/api/v1/instances" \
  -H "Authorization: Bearer MC_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "sku_class": "cpu",
    "image": "ubuntu-22.04",
    "ssh_keys": ["your-key-name"]
  }'

Wait for the VM to reach Running status before proceeding. This typically takes 1-3 minutes.

2

Connect via SSH

SSH into your new VM using the IP address from the launch response.

ssh ubuntu@YOUR_VM_IP

Replace YOUR_VM_IP with the actual IP address assigned to your VM.

3

Remove Conflicting Packages

Clean up any existing container packages that might conflict with Docker Engine.

for p in docker.io docker-doc docker-compose podman-docker containerd runc; do
    sudo apt-get remove -y $p 2>/dev/null || true
done

This command safely removes conflicting packages without errors if they’re not installed.

4

Install Prerequisites

Update the package index and install required dependencies for adding Docker’s repository.

sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
5

Add Docker GPG Key

Download and install Docker’s official GPG signing key for package verification.

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
  sudo gpg --batch --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
6

Add Docker Repository

Add the official Docker repository to your system’s package sources.

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
sudo apt-get update
7

Install Docker Engine

Install Docker Engine, CLI tools, containerd, buildx plugin, and compose plugin.

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

This installs all the core Docker components needed for container development.

8

Configure User Permissions

Add your user to the docker group to run Docker commands without sudo.

sudo usermod -aG docker $USER

You’ll need to log out and back in for the group membership to take effect, or use sudo for Docker commands until you reconnect.

9

Verify Installation

Test that Docker Engine is running and accessible.

sudo systemctl is-active docker
sudo docker version
sudo docker run --rm hello-world

The first command should return active, the second should show client and server versions, and the third should pull and run a test container.

Troubleshooting Common Issues

Docker Service Not Starting

If systemctl is-active docker returns inactive or failed, check the service logs:

sudo journalctl -u docker -n 30

Common causes include insufficient disk space, permission issues with /var/lib/docker, or conflicting container runtimes.

Permission Denied Errors

If you get permission errors when running Docker commands:

  • Verify you’re in the docker group: groups $USER
  • Log out and back in to refresh group membership
  • Use sudo docker commands as a temporary workaround

Container Pull Failures

If docker run hello-world fails to pull the image:

  • Check internet connectivity: ping 8.8.8.8
  • Verify DNS resolution: nslookup docker.io
  • Check for proxy settings in /etc/systemd/system/docker.service.d/

Skip All of This: Deploy with an AI Agent

This entire Docker Engine setup exists as a tested, machine-readable recipe in the Massed Compute MCP. Instead of running the steps manually, connect your AI assistant and let it handle the provisioning and configuration.

Add this configuration to your MCP settings:

{
  "mcpServers": {
    "massed-compute": {
      "type": "http",
      "url": "https://vm.massedcompute.com/api/mcp",
      "headers": { "Authorization": "Bearer MC_TOKEN" }
    }
  }
}

Then say:

“Install Docker Engine on a new Ubuntu 22.04 VM with 2 vCPU and 2GB RAM. Set up user permissions and verify the installation works.”

The agent matches your request against the recipe catalog, provisions the right VM shape, runs the installation and verification steps above, and reports back with the result. If any step fails, it stops and provides the error details rather than continuing with a broken setup.

Recipe last tested: June 2, 2026

Ready to Deploy Docker Containers?

Get your Docker environment running in minutes with our optimized Ubuntu VMs and automated setup recipes.

Think it. Build it. Scale it.

Quick Setup Reference

For experienced users, here’s the complete installation in one script block:

# Remove conflicting packages
for p in docker.io docker-doc docker-compose podman-docker containerd runc; do
    sudo apt-get remove -y $p 2>/dev/null || true
done

# Install prerequisites
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings

# Add Docker GPG key and repository
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
  sudo gpg --batch --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

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

# Install Docker Engine
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io \
  docker-buildx-plugin docker-compose-plugin

# Configure user permissions
sudo usermod -aG docker $USER

# Verify installation
sudo systemctl is-active docker
sudo docker version
sudo docker run --rm hello-world

Frequently Asked Questions

01Do I need to install Docker Compose separately?

No, this guide installs the docker-compose-plugin which provides docker compose (v2) commands. The standalone docker-compose (v1) is deprecated and not needed.

02Can I install Docker on other Ubuntu versions?

Yes, Docker supports Ubuntu 20.04, 22.04, and newer versions. The installation steps are similar, but the repository URL will automatically detect and use your Ubuntu version codename.

03Why add the user to the docker group?

The docker group allows users to run Docker commands without sudo. Without this, you’d need to prefix every docker command with sudo, which is inconvenient for development workflows.

04What’s the difference between Docker Engine and Docker Desktop?

Docker Engine is the server-side runtime that runs containers. Docker Desktop includes Engine plus a GUI, VM management, and other developer tools. For server deployments, Docker Engine alone is sufficient.

05How do I uninstall Docker if needed?

Run sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin, then remove leftover files with sudo rm -rf /var/lib/docker /var/lib/containerd.