Ubuntu 24.04 - Install Docker

Ubuntu 24.04 - Install Docker

How to install Docker on Ubuntu 24.04

Arman Dwi Pangestu
Arman Dwi PangestuJanuary 6, 2026
0 views
1 min read

Introduction

In this article, we will learn how to install Docker on Ubuntu 24.04. Docker is a containerization platform that allows you to package and run applications in containers, which are lightweight, portable, and self-sufficient.

Add Docker Repository

Before installing Docker, we need to add the Docker repository to our system. This can be done by running the following command:

bash
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
 
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

Install Docker Package

After adding the Docker repository, we can install the Docker package by running the following command:

bash
sudo apt update && apt-cache policy docker-ce && sudo apt install docker-ce
 
sudo systemctl status docker

Add Current User to Docker Group

After installing Docker, we need to add the current user to the Docker group to allow the user to run Docker commands without using sudo. This can be done by running the following command:

bash
sudo usermod -aG docker ${USER} && su - ${USER}

Install Docker Compose

After installing Docker, we can install Docker Compose by running the following command:

bash
sudo apt update && sudo apt install docker-ce-cli containerd.io docker-compose-plugin docker-compose
 
docker compose version

Docker Command Cheatsheet

There are several Docker commands that we can use to manage and run our containers. Here are some of the most Docker commands that we can use:

List Container

bash
docker ps -a

Enter Into Container Interactive Shell

Important

Change container_name with actual container name

bash
docker exec -it container_name /bin/bash

Stop & Remove All Docker Container

bash
docker stop $(docker ps -a -q)
 
docker rm $(docker ps -a -q)

Location Docker Container Volume on Local Drive

bash
sudo ls /var/lib/docker/volumes

Docker Monitor Log Container

Important

Change container_name with actual container name

bash
docker logs -f container_name

Docker Inspect Container Configuration

Important

Change container_name with actual container name

bash
docker inspect container_name

Docker Compose Up & Down

bash
docker compose up -d
 
docker compose down

Related Posts