Config Server Firewall

Ubuntu 24 Docker Installation Tutorial (For Server & Desktop)

In this tutorial, we will learn how to install Docker Engine on Ubuntu 24.04. Docker is a container platform that offers isolated environments for applications, aiding in development, testing, and deployment.

You can use this guide to install docker for both Ubuntu Server and Ubuntu Desktop.

How to Do It: Step-by-Step Instructions

To install Docker in Ubuntu 24.04, we'll run the following three commands:

for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

How It Works

The first command uninstalls any previous versions or conflicting packages, ensuring that you're not running older versions of Docker.

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

The second command downloads the Docker installation script for Ubuntu.

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

The third command installs the Docker Engine on Ubuntu.

sudo sh get-docker.sh

Verifying Docker Installation

After the installation is complete, you can run the following command to check the Docker version installed on your Ubuntu system:

docker version

The command will print the Docker client and Docker Engine versions. The client is the command-line tool we use to interact with the Docker Engine.

docker version installed on ubuntu

Run a Simple Test Container to Verify Docker Is Working

To make sure Docker is working properly, you can run the hello-world container:

docker run hello-world

If you see the 'Hello from Docker' message, it means Docker is installed and running correctly.

install docker in ubuntu 24

What's Next?

Next, check out our detailed guide on starting Docker containers with the docker run command.

Docker Run: Start Docker Containers from an Image

For more on managing Docker containers, check out our Docker tutorial series.