Skip to main content

Docker Install

Introduction

This guide will cover how to install Docker on Ubuntu 24.04

Remove Conflicting Packages

The first step is to remove packages that may conflict with the installation

for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done

Prepare For Installation

Update apt

sudo apt-get update

Install Dependencies

sudo apt-get install ca-certificates curl

Create keyring directory

sudo install -m 0755 -d /etc/apt/keyrings

Download GPG key

sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc

Set Permissions

sudo chmod a+r /etc/apt/keyrings/docker.asc

Add Repository

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

Install Docker

Install

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

Verify

Verify the installation completed successfully

sudo docker ps

Add User to Docker Group (Optional)

If you want to allow for docker commands without sudo, you can add your user to the docker group. This comes with security implications and I do not do this.

sudo usermod -aG docker $USER