Technical News and Knowledge Base Articles along with How to Step by Step Guides for SMB and Enterprise

Installing, Setting Up, and Configuring Docker Engine on Ubuntu 24.04

Docker is a platform for developing, shipping, and running applications inside containers. This guide will walk you through installing Docker Engine on Ubuntu 24.04, including adding the Docker repository, installing components, verifying the installation, configuring user permissions, ensuring Docker starts at boot, and basic Docker usage.


  • Ubuntu 24.04 installed on your system.
  • A user account with sudo privileges.

Step 1: Update Your System

Before installing Docker, it’s essential to update your system’s package index:

sudo apt update
sudo apt upgrade -y

Step 2: Install Required Packages

Install packages that allow apt to use a repository over HTTPS:

sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg lsb-release -y

Step 3: Add Docker’s Official GPG Key

Add Docker’s official GPG key to your system:

curl -fsSL | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Step 4: Set Up the Stable Repository

Add the Docker APT repository:

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Step 5: Install Docker Engine

Update the package index and install Docker Engine:

sudo apt update
sudo apt install docker-ce docker-ce-cli -y

Step 6: Verify Docker Installation

Verify that Docker is installed correctly by running a test image:

sudo docker run hello-world

Step 7: Manage Docker as a Non-root User

To run Docker commands without sudo, create a Docker group and add your user:

sudo groupadd docker
sudo usermod -aG docker $USER

Log out and log back in so that your group membership is re-evaluated. You can also run the following command to apply the new group membership:

newgrp docker

Step 8: Configure Docker to Start on Boot

Ensure Docker starts when your system boots:

sudo systemctl enable docker
sudo systemctl enable containerd

Step 9: Build and Run a Docker Container

Create a simple Dockerfile to build a Docker image:

  1. Create a directory for your Dockerfile: mkdir mydockerapp cd mydockerapp
  2. Create a file named Dockerfile and add the following content: FROM ubuntu:latest RUN apt-get update && apt-get install -y python3 CMD ["python3", "--version"]
  3. Build the Docker image: docker build -t mypythonapp .
  4. Run the Docker container: docker run mypythonapp

Additional Tips and Tricks

Viewing Docker Processes

To see all running Docker containers:

docker ps

To see all containers (including stopped ones):

docker ps -a

Removing Docker Containers and Images

To remove a stopped container:

docker rm <container_id>

To remove an image:

docker rmi <image_id>

Cleaning Up Unused Resources

Docker provides commands to clean up unused resources:

docker system prune

Inspecting Docker Containers

To inspect a Docker container for debugging:

docker inspect <container_id>

Security Considerations

  • Ensure Docker and your operating system are up-to-date to protect against vulnerabilities.
  • Use Docker’s security features such as user namespaces, seccomp profiles, and AppArmor/SELinux policies.
  • Be cautious when running third-party Docker images and verify their authenticity.


By following these comprehensive steps, you have installed, set up, and configured Docker Engine on Ubuntu 24.04. You have also learned how to manage Docker as a non-root user, ensure Docker starts on boot, build Docker images, and run Docker containers.

For more detailed information, refer to the official Docker documentation.