RackUp IT - View Cloud Hosting Plans

Get started now or speak directly with our engineering team for specialized assistance.

Logo
DevelopmentWEB & APPCalculatorTOOLServicesProductBlogOur TeamCareers
View Plans
Home>Blog>How to Install Docker on Ubuntu (26.04, 24.04 and 22.04)
DevOps & Tutorials

How to Install Docker on Ubuntu (26.04, 24.04 and 22.04)

Alex Vance
Alex Vance
Published Oct 27, 2026•✓ Verified Expert Reviewed•5 min read
Install Docker on Ubuntu cover

Key Takeaways

  • ✓Install Docker from Docker's own apt repository, not Ubuntu's docker.io package.
  • ✓The Compose plugin gives you docker compose (with a space).
  • ✓Adding a user to the docker group grants root-level access.
  • ✓Turn on log rotation so container logs don't fill the disk.

Table of Contents

  • •How to Install Docker on Ubuntu (26.04, 24.04 and 22.04)
  • •Supported Ubuntu Versions
  • •Step 1: Remove Old or Conflicting Packages
  • •Step 2: Add Docker’s apt Repository
  • •Step 3: Install Docker Engine and Compose
  • •Step 4: Verify the Installation
  • •Step 5: Run Docker Without sudo
  • •Step 6: Start Docker on Boot
  • •Step 7: Turn On Log Rotation
  • •The Firewall Gotcha: Docker Bypasses UFW
  • •Alternative: The Convenience Script
  • •Updating and Uninstalling Docker
  • •Troubleshooting
  • •Frequently Asked Questions
  • •Run Docker Without Managing the Server

How to Install Docker on Ubuntu (26.04, 24.04 and 22.04)

The reliable way to install Docker on Ubuntu is from Docker’s own apt repository. You get the current Docker Engine, the Compose plugin and security updates through normal apt upgrade, instead of the older docker.io package from Ubuntu’s archive. This guide follows Docker’s official instructions step by step, then covers running Docker without sudo, starting it at boot, log rotation and the firewall gotcha that catches most people on a VPS.

Quick answer: remove old packages, add Docker’s GPG key and repository, then run sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin. Check it with sudo docker run hello-world.

Supported Ubuntu Versions

Docker Engine supports these 64-bit Ubuntu releases (checked on Docker’s install page, 26 October 2026):

  • Ubuntu 26.10

  • Ubuntu 26.04 LTS

  • Ubuntu 24.04 LTS (Noble)

  • Ubuntu 22.04 LTS (Jammy)

It runs on x86_64 (amd64), arm64, armhf, s390x and ppc64le, so the same steps work on most cloud VPS servers, including ARM machines. Check your version with lsb_release -a or cat /etc/os-release.

Step 1: Remove Old or Conflicting Packages

Ubuntu’s own repositories ship unofficial packages such as docker.io and podman-docker that conflict with Docker’s packages. Remove any that are installed:

sudo apt remove $(dpkg --get-selections docker.io docker-compose docker-compose-v2 docker-doc docker-buildx podman-docker containerd runc | cut -f1)

If none are installed, apt simply reports that there is nothing to remove. Existing images and volumes in /var/lib/docker/ are not deleted by this step.

Step 2: Add Docker’s apt Repository

First add Docker’s official GPG key, so apt can verify the packages:

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

Then add the repository. This writes a .sources file that picks your Ubuntu codename and CPU architecture automatically:

sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF

sudo apt update

Step 3: Install Docker Engine and Compose

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

This installs five packages:

PackageWhat it does
docker-ceThe Docker Engine daemon
docker-ce-cliThe docker command
containerd.ioThe container runtime Docker uses underneath
docker-buildx-pluginBuildKit-based docker build and multi-platform builds
docker-compose-pluginCompose v2, used as docker compose (with a space)

The service starts automatically after installation. Check it with sudo systemctl status docker.

Step 4: Verify the Installation

sudo docker run hello-world
docker --version
docker compose version

hello-world downloads a tiny test image, runs it, prints a confirmation message and exits. If you see “Hello from Docker!”, the engine, the image download and the container runtime all work.

Step 5: Run Docker Without sudo

By default only root can talk to the Docker daemon. To use docker as your normal user, add yourself to the docker group:

sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
docker run hello-world

(groupadd may say the group already exists; that’s fine.) Log out and back in if newgrp doesn’t take effect in your session.

Security note: Docker’s documentation warns that the docker group grants root-level privileges to the user. Only add accounts you would trust with root.

Step 6: Start Docker on Boot

On Ubuntu the services are normally enabled already, but you can make sure with:

sudo systemctl enable docker.service
sudo systemctl enable containerd.service

Step 7: Turn On Log Rotation

The default json-file logging driver writes container logs to files on the host and, as Docker’s docs point out, they can eventually fill the disk. On a small VPS this is one of the most common causes of a “no space left on device” error months later. Set a size limit in /etc/docker/daemon.json:

{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  }
}

Then restart Docker with sudo systemctl restart docker. The limit applies to containers created after the change; recreate existing ones to pick it up. To read and clean logs, see our guide to tailing and clearing Docker logs.

The Firewall Gotcha: Docker Bypasses UFW

If you use UFW, know this before you publish ports: when you run a container with -p 8080:80, Docker adds its own iptables rules, and traffic to that port can reach the container even if UFW looks like it blocks it. Two safe habits:

  • Publish ports only on localhost when a reverse proxy sits in front: -p 127.0.0.1:8080:80.

  • Use your cloud provider’s firewall as an outer layer.

We explain the details in how to open ports on a VPS.

Alternative: The Convenience Script

Docker also publishes a one-line install script:

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

Docker recommends it only for testing and development environments. For a server you’ll keep, use the repository method above so you know exactly what was installed and upgrades stay predictable.

Updating and Uninstalling Docker

Because Docker now comes from an apt repository, updates arrive with the rest of the system:

sudo apt update && sudo apt upgrade

To remove Docker completely, including all images, containers and volumes (this deletes data):

sudo apt purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
sudo rm -rf /var/lib/docker /var/lib/containerd

Troubleshooting

  • “permission denied while trying to connect to the Docker daemon socket”: your user isn’t in the docker group yet, or the session hasn’t picked it up. Run newgrp docker or log in again.

  • “Unable to locate package docker-ce”: the repository wasn’t added or apt update wasn’t run after adding it. Check /etc/apt/sources.list.d/docker.sources.

  • “docker: unknown command: docker compose”: the Compose plugin isn’t installed. Install docker-compose-plugin.

  • Cannot connect to the Docker daemon: the service is stopped. Run sudo systemctl start docker and check journalctl -u docker for the reason.

Frequently Asked Questions

Should I install docker.io or docker-ce on Ubuntu?
Use docker-ce from Docker’s repository. docker.io is Ubuntu’s own package and is often older; Docker’s install guide asks you to remove it first because the two conflict.

Does Docker Compose come with Docker on Ubuntu?
Yes, if you install docker-compose-plugin as shown above. You then run it as docker compose (with a space). The old standalone docker-compose (with a hyphen) is no longer needed.

How much RAM does Docker need on Ubuntu?
The engine itself is light; what you need depends on your containers. A database and a web app together usually need at least 1–2 GB of RAM to run comfortably.

Can I install Docker on Ubuntu WSL?
Yes. The same apt steps work inside an Ubuntu WSL 2 distribution, or you can use Docker Desktop on Windows with WSL 2 integration.

Is Docker free on Ubuntu?
Docker Engine is open source and free to use on Linux servers. Docker Desktop has its own licence terms for larger companies, but you don’t need Desktop on an Ubuntu server.

Run Docker Without Managing the Server

If you want root access and your own Docker host, RackUp’s Developer VPS gives you 8 vCPU, 12 GB RAM, 150 GB NVMe and 32 TB of monthly bandwidth for $35 a month, with full root access. If you’d rather skip server work entirely, Cloud Apps run your Dockerfile in a container with a private database and deploy on every Git push, from $2.44 a month. Compare plans.

← Previous ArticleHow to Install an SSL Certificate on WordPress (and Fix Mixed Content)
Interactive 60-Second Tool

Unsure Which Cloud Hosting Plan Fits Your Site?

Answer 4 quick diagnostic questions to estimate the server CPU, RAM and storage you need with transparent pricing.

Free Migration 99.9% Uptime Target
Calculate My Hosting Build
Alex Vance
Written ByAlex Vance

Cloud Infrastructure Engineer.

99.9% Uptime Target

RackUp IT - View Cloud Hosting Plans

View Hosting Plans

View Hosting Plans

CONTENTS

  • How to Install Docker on Ubuntu (26.04, 24.04 and 22.04)
  • Supported Ubuntu Versions
  • Step 1: Remove Old or Conflicting Packages
  • Step 2: Add Docker’s apt Repository
  • Step 3: Install Docker Engine and Compose
  • Step 4: Verify the Installation
  • Step 5: Run Docker Without sudo
  • Step 6: Start Docker on Boot
  • Step 7: Turn On Log Rotation
  • The Firewall Gotcha: Docker Bypasses UFW
  • Alternative: The Convenience Script
  • Updating and Uninstalling Docker
  • Troubleshooting
  • Frequently Asked Questions
  • Run Docker Without Managing the Server

Categories

  • DevOps & Tutorials
  • Cloud Hosting
  • WordPress Hosting
  • Networking & Security
  • Web Hosting / Managed Cloud
  • VPS Hosting
  • Server Stack
  • E-Commerce
  • Hosting & SEO
  • Hosting Benchmarks
  • Cloud Backup & DevOps
  • Managed VPS

Recent Posts

  • How to Install an SSL Certificate on WordPress (and Fix Mixed Content)
  • How to Deploy Django to a VPS With Gunicorn and Nginx (Ubuntu)
  • How to Update Node.js to the Latest Version (nvm, Windows, macOS, Linux)

Tags

DockerUbuntuLinuxVPSTutorialHerokuVercelApp HostingComparisonWordPressMigrationTroubleshootingManaged WordPressBackupsWP-CLIStagingUFWFirewallSecurityJavaSpring BootWeb HostingBeginnersGuideCoolifyDokployDokkuKamalSelf-HostedSystem RequirementsNode.jsPortainerDockgeToolsWordPress HostingNetworkingRailwayRenderDedicated ServerPerformanceUpgradeNext.jsReactDocker ComposeVultrDigitalOceanBluehostDocker DesktopDevOpsCloud HostingApacheWeb ServerNginxHTTPSRedirectsSSLLinodeAkamaiHostingerInstallFirebaseSupabaseAppwriteBackendPythonFlaskFastAPIDjangoDomainsSEONetlifyCloudflarePHPErrorsDeveloper HostingAgency HostingClient SitesKubernetesTraefikCaddyReverse ProxySiteGroundMonitoringPrometheusPostgrescPanelControl PanelMySQLGunicornDeploymentJavaScriptnvmContainersLoad BalancingScalingVPS HostingConfigurationLet's EncryptCertbotChecklistDNSCloudwaysKinstaWP EngineLaraveldocker logsDisk Spacedocker execiptablesfirewalldError Codes404 Not Found403 ForbiddenLinux PermissionsSELinuxOracle CloudAmpere A1ARMFree TierOCIRegions502 Bad GatewayPHP-FPMcPanel HostingAffordable HostingCheap VPSCloud VPSHosting BenchmarksSpeed OptimizationSpeed Up WordPressCore Web VitalsNGINX FastCGIOPcacheWooCommerceRedis CachePHP WorkersE-CommerceSecure WordPress HostingWordPress SecurityContainer IsolationWordPress HardeningWordPress StagingStaging SiteWP StagingScalable HostingHigh Traffic WordPressUK Web HostingManaged VPSLeeds Web HostingWooCommerce PerformanceStatic IPReserved IPOCI VNICOCI BackupRcloneDisaster RecoveryManaged HostingVPS BenchmarkWest Yorkshire RetailManaged VPS HostingUK Server LatencyPort MappingBangladeshidaho hostingCloudPanelidaho webhostingManaged Wordpress VPSManaged Cloud

Related Posts

Point Custom Domain & Setup Free SSL on Oracle Cloud VPS Cover ImageDevOps & Tutorials
Jul 28, 2026

How to Point Custom Domain & Setup Free SSL on Oracle Cloud VPS

Learn how to point a custom domain to Oracle Cloud VPS and install free Let's Encrypt SSL with Certbot and Nginx in this complete step-by-step tutorial.

Read Article →
Install SSL on WordPress guide coverWordPress Hosting
Oct 23, 2026

How to Install an SSL Certificate on WordPress (and Fix Mixed Content)

How to move a WordPress site to HTTPS: get a free certificate, update the site URLs, fix mixed content, force HTTPS at the server, and avoid the common redirect loop.

Read Article →
Deploy Django with Gunicorn and Nginx coverVPS Hosting
Oct 22, 2026

How to Deploy Django to a VPS With Gunicorn and Nginx (Ubuntu)

Deploy Django to a VPS: Gunicorn as the app server managed by systemd, Nginx in front for static files and HTTPS, a firewall, and fixes for the usual 502 and static-file errors.

Read Article →
Logo

Expert Web & App Development, UI/UX Design, Branding, and Consulting to scale your business.

Company

  • About Us
  • Blog
  • Contact
  • Our Team
  • Careers

Services

  • Web Development
  • App Development
  • UI/UX Design
  • Consulting

Subscribe to our newsletter

© 2026 Rackup IT Solution. All rights reserved.

Privacy PolicyTerms of Service