This guide walks you through the process of installing Docker on Ubuntu 24.04. Whether you’re a developer, system administrator, or hobbyist, Docker allows you to containerize applications and run them efficiently across different environments. Follow these steps to get Docker up and running on your system in minutes.
Prerequisites
- A system running Ubuntu 24.04.
- A user account with sudo privileges.
- Internet connection.
Step 1: Update the System
Before installing Docker, update the existing list of packages:
sudo apt update
sudo apt upgrade -y
BashStep 2: Install Required Dependencies
Install packages that allow apt
to use repositories:
sudo apt install apt-transport-https ca-certificates curl software-properties-common
BashStep 3: Add Docker’s Official GPG Key
Grab the Keyring:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
BashAdd the Docker repository to APT:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
BashStep 4: Install Docker
Update the APT package index:
sudo apt update
BashInstall Docker and its components:
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
BashStep 5: Verify Installation
Docker should now be installed, the daemon started, and the process enabled to start on boot. Check that it’s running:
sudo systemctl status docker
BashOptional: Run Docker as a Non-Root User
To avoid using sudo
with Docker commands:
- Add your user to the
docker
group:
sudo usermod -aG docker $USER
BashMake sure you replace $USER
with your username
- Log out and log back in.
- Test again.
docker run hello-world
BashConclusion
Docker should now be installed and running on your Ubuntu 24.04 system. You’re ready to start building and running containers!