Migrate to RunxBuild and earn up to $50 in hosting credit on your first deposit.

Calculate your savings
unxBuild

Installation of Docker in Ubuntu: Step-by-Step for 22.04 and 24.04

Sean

Platform Writer

Jul 05, 2026
6 min read

Installation of Docker in Ubuntu: remove old docker, docker.io, containerd packages; add Docker’s official apt repo; install docker-ce. The DigitalOcean guide walks through the same steps for older Ubuntu; the 2026 version for 22.04 and 24.04 follows. The team that skips the ‘remove old versions’ step has conflicts.

Installation of Docker in Ubuntu: Step-by-Step for 22.04 and 24.04

Table of contents

Remove old versions

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

Or if dpkg -l | grep -i docker shows nothing, skip. The team that has old docker-engine packages gets conflicts without this step.

Install prerequisites

sudo apt update
sudo apt install ca-certificates curl gnupg

The team that has these installed is ready to add Docker’s repo.

Add Docker’s GPG key and repo

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

The team that runs on Ubuntu 24.04 sees noble in the repo URL. On 22.04 it’s jammy.

Install Docker

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

Installs the latest stable. The team that wants a specific version uses apt list -a docker-ce to see available versions, then sudo apt install docker-ce=<version>.

Verify

sudo systemctl status docker
sudo docker run hello-world

The team that sees ‘active (running)’ and the hello-world output has a working install.

Post-install: non-root user

sudo usermod -aG docker $USER
newgrp docker
docker run hello-world  # no sudo

The team that adds the user to docker group has rootless docker usage (still root inside containers).

Ubuntu-specific notes

  • Ubuntu’s docker.io package is older - use Docker’s repo.
  • Ubuntu’s AppArmor might block docker; sudo aa-complain /usr/bin/docker if needed.
  • Ubuntu’s default firewall (ufw) doesn’t block docker by default.
  • Ubuntu 24.04 uses cgroup v2 by default; some older docker features need adjustment.

Troubleshooting

Cannot connect to Docker daemon:

  • sudo systemctl start docker.
  • Check /var/run/docker.sock exists.
  • Check user is in docker group.

Permission denied:

  • sudo usermod -aG docker $USER then log out/in.
  • Or sudo docker (avoid).

FAQ

Which Ubuntu version is supported?

Docker officially supports the current LTS (22.04, 24.04) and recent non-LTS. Older versions may work with the docker.io package but won’t get updates.

Can I install Docker without root?

Yes - rootless mode. More complex setup but better security. The team that has compliance requirements uses rootless.

What’s the difference between docker-ce and docker-ee?

docker-ce: Community Edition, free. docker-ee: Enterprise Edition, paid with support. Most teams use docker-ce.

Do I need to uninstall the snap version of Docker?

Yes if installed. Snap’s docker runs in a confined environment with limitations. The team that uses the apt version has full features.

How do I update Docker?

sudo apt update && sudo apt upgrade upgrades Docker along with other packages. The team that uses unattended-upgrades has automatic Docker updates.

If you are sizing the infrastructure for the kind of project this post covers, the RunxBuild hosting calculator is the right place to model the line items. The compute, the memory, the storage, the bandwidth, the database - each one is a separate number, and the team’s mental model for the platform is the sum of those numbers. The RunxBuild dashboard is where the team sees the actual usage in one place.

Useful related references:

#docker#ubuntu#install#dev-infra