Installing Docker on Ubuntu 24.04

Last update: 06-14-2024

Docker is a powerful platform for developing, shipping, and running applications inside containers. It works best on Linux due to its native integration with the Linux kernel, leading to more efficient and faster performance compared to Windows and macOS, which rely on virtual machines to run Docker.

This short blog post will provide you with all the instruction you need to install and set up the latest version of Docker on your Ubuntu 24.04 server or workstation.

You can visit the official documentation at Docker's official site, but it might be more convenient to copy the commands from here as I have gathered all the needed commands in one place:


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

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install -y 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

# Add the repository to Apt sources:
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

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

sudo groupadd docker
sudo usermod -aG docker $USER

After running these commands, reboot your machine. Then, to verify the installation, run:

docker run hello-world

You should see the "Hello from Docker!" message, indicating that Docker is installed and running correctly:

Hello from Docker message

StocksComparison.com ad
 

3 Comments

Add a new comment: