Containerization technology enables you to package your applications with its dependencies and run them on any Linux distribution or environment with container engine. The goal of containerization is easy builds, management, and distribution of the software across multiple environments. The isolated environment provided by containerization, is sometimes referred to as a sandbox – the application and its dependencies live there!.
We can define a container as a standalone, lightweight, and executable software package with the code, system tools, runtime, and libraries required to run that piece of software. Docker is one of the critical requirement when working with containers. Just imagine Docker as simply a tool used to create, run, and manage these containers from command line. To create an instance of the container, you will need a Dockerfile which provides a set of instructions for building a Docker Image.
The Ultimate Ubuntu Desktop Handbook
Master Ubuntu like a pro - from beautiful desktop customization to powerful terminal automation. Perfect for developers, system admins, and power users who want total control of their workspace.
The resulting product of Dockerfile is a Docker image and this serves as a template in the creation of containers. An image will contain the code and all necessary tools – runtime, libraries, and any other system tool required to run the software application. By the end of this post, you will have Docker Engine running, and deploy a running instance of an application in the container.
Installation Requirements
You should be able to install Docker Engine on any system of Ubuntu with x86_64 (or amd64), arm64, armhf, s390x, and ppc64le (ppc64el) CPU hardware.
Also ensure ensure that:
- Your system has internet access
- You are accessing the system as root user or user with sudo privileges
- The system has adequate storage to store container data
- Adequate amount of memory and CPU is available for running containers
- You have some minutes to perform the installation
Docker Installation steps on Ubuntu 24.04 (Noble Numbat)
While Ubuntu 24.04 (Noble Numbat) primary repository will contain a package for Docker setup, this might be outdated edition when compared to the version provided by Docker Developers. Therefore, installation of recent Docker Engine package is better performed from the Docker upstream repository.
Here are the elements of Docker;
- Docker Engine: This is responsible for building and running of containers on the host machine.
- Docker Daemon: A running process that will manage Docker containers
- Docker Client: A command lone tool used to execute commands and interact with running containers.
- Docker Compose: Used to easily manage multiple containers that powers a single service.
Configuring Docker repository
To get the the latest release of Docker application, begin the process by adding the APT repositories supported by Docker Team. Perform the basic steps of updating and upgrading your system.
sudo apt update && sudo apt upgrade -y
If a reboot is required after the upgrade please consider taking the action.
[ -f /var/run/reboot-required ] && sudo reboot -f
Import Docker APT repository GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg| sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/docker.gpg
Add the repository to Apt sources:
echo "deb https://download.docker.com/linux/ubuntu noble stable" | sudo tee /etc/apt/sources.list.d/docker.list
Update repositories list in the system to confirm it’s working.
$ sudo apt update
Hit:1 http://ke.archive.ubuntu.com/ubuntu noble InRelease
Hit:2 http://ke.archive.ubuntu.com/ubuntu noble-updates InRelease
Get:3 http://ke.archive.ubuntu.com/ubuntu noble-backports InRelease [90.8 kB]
Get:4 https://download.docker.com/linux/ubuntu noble InRelease [47.0 kB]
Hit:5 http://security.ubuntu.com/ubuntu noble-security InRelease
Get:6 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages [3,781 B]
Fetched 141 kB in 1s (218 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
Install Docker Engine package
When the repository has been configured, the package can easily be installed using aptpackage manager.
sudo apt install docker-ce docker-ce-cli docker-buildx-plugin docker-compose-plugin containerd.io
In the package list, we’ve included other Docker dependencies required for smooth operations. Verify it works by querying for the version installed.
$ docker --version
Docker version 26.0.1, build d260a54
The Compose plugin should also be available to use in the command line.
$ docker compose version
Docker Compose version v2.26.1
How To Use Docker After Installation
In this section we are going to create a Dockerfile and build simple Apache web server application. A Dockerfile is a text file written in YAML format with instructions for image building. The result from this process is a container image, which when executed is called “container”.
Let’s create a sample Dockerfile on our Ubuntu 24.04 system.
vim Dockerfile
Define the contents of the file – set of instructions.
# Base image to use
FROM debian
# Maintainer name and Email address
MAINTAINER Josphat <[email protected]>
# Update package index
RUN apt update
# Install required packages
RUN apt -y install tzdata apache2
# Add contents to default index.html page
RUN echo "Apache Web Server Test from Container" > /var/www/html/index.html
# Expose the service on port 80
EXPOSE 80
# Specify commands required to start the service
CMD ["/usr/sbin/apachectl", "-D", "FOREGROUND"]
Add your user account to docker group not logged in as root user.
sudo usermod -aG docker $USER
Start a session while using docker group. This prevents the need to logout then back in.
newgrp docker
Build the image while giving it a tag.
docker build -t computingforgeeks/debian-apache2:latest ./
Sample output from the command.

List created container images.
jkmutai@ubuntu2204-server:~$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
computingforgeeks/debian-apache2 latest 201023e62f61 About a minute ago 253MB
Once the image has been built, we can create a container instance from it using the docker run command.
docker run -d -p 8081:80 computingforgeeks/debian-apache2
Confirm if the container is running using the docker ps command.
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
08d253e467f3 computingforgeeks/debian-apache2 "/usr/sbin/apachectl…" 27 seconds ago Up 27 seconds 0.0.0.0:8081->80/tcp, :::8081->80/tcp fervent_wilbur
Test access to the container using curl on the port exposed.
$ curl localhost:8081
Apache Web Server Test from Container
The service can also be accessed on the browser using your Ubuntu server/desktop IP address. Next we give you bonus docker commands to manage the container.
- Check Container logs
docker logs <ContainerID>
- Start shell session inside the container
jkmutai@ubuntu2204-server:~$ docker exec -ti <ContainerID> bash
root@08d253e467f3:/# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
root@08d253e467f3:/# exit
- List binding ports
$ docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' <ContainerID>
80/tcp -> 8081
- Stop the container
docker stop <ContainerID>
- Delete the container
$ docker rm <ContainerID>
08d253e467f3
You can refer to the official documentation on Docker CLI for more information.
To conclude, experimenting with containers and Docker is key in beginning the journey into the world of containerization and microservices. For application developers, you will benefit from how docker enables you to standardize your builds, tests and deployments across different environments. We can attest to the fact that containers provide a portable and efficient way to package your applications while including all the dependencies for consistency across varying environments.





































































