Docker is an OS-level virtualization platform designed to deliver applications in a lightweight, isolated runtime environment - containers. Containers share the same operating system resources, so they are much lighter than virtual machines, which ensures fast startup and reliable isolation. In this tutorial, you will learn how to install the Docker platform on a Linux operating system.
Before starting the Docker installation, remove any old packages to avoid conflicts with the official ones.
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do
sudo apt-get remove -y $pkg 2>/dev/null || true
done
Add the official Docker GPG key with the following commands:
sudo apt-get updateAdd the Docker repository to APT:
sudo apt-get install 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
echo \Finally, install Docker with this command:
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
After installation, verify that Docker is working properly by running the hello-world container:
sudo docker run hello-world
This command pulls a test image and runs it in a Docker container. When the container starts, you will see a confirmation message in the terminal.
How to run Grafana in Docker containerGrafana is a leading open-source tool for visualizing time series data. It’s widely used to visualize data from various...
How to Install a Graphical User Interface (GUI) on Ubuntu 24.04 Server OSThe Ubuntu Server operating system is normally designed to run without a graphical...