In this guide, you will learn how to install Docker on a Linux system and get started quickly, using Ubuntu Server 22.04 LTS, 24.04 LTS, and 25.04 as examples.
Containers have become a vital part of modern IT infrastructure due to their lightweight and efficient nature. They package everything required to run an application, such as code, libraries, runtime, and dependencies, without the need for a full operating system, unlike virtual machines. This allows businesses to deploy scalable and resource-efficient services, such as running multiple NGINX instances, with ease. Docker simplifies container management and integrates seamlessly with Linux-based systems.
Follow the steps:
- System Update
As Ubuntu Server lacks a graphical interface, all tasks will need to be carried out via the command line. Initially, ensure your system is up to date before installing Docker:sudo apt update sudo apt upgrade
If a kernel update is part of the upgrade, remember to reboot the system afterwards:
sudo reboot
- Install Docker
To install Docker on Ubuntu, run:sudo apt install docker.io
For Fedora:
sudo dnf install docker
For CentOS 7:
Use the Docker installation script:sudo yum check-update curl -fsSL https://get.docker.com/ | sh
- Manage Docker Permissions
By default, Docker commands require administrative privileges. To avoid using sudo with every Docker command, add your user to the docker group:sudo usermod -a -G docker $USER
Log out and log back in.
Note: Fedora users might need to create the Docker group manually:sudo groupadd docker sudo gpasswd -a ${USER} docker sudo systemctl restart docker newgrp dockerLog out and log back in again.
- Manage the Docker Service
To start and enable Docker to launch at boot:sudo systemctl start docker sudo systemctl enable docker
To stop or restart Docker:
sudo systemctl stop docker sudo systemctl restart docker
- Pull Docker Images
Docker images are the foundation of containers. You can download images from Docker Hub.
Check available images on your system:docker images
To pull the latest official NGINX image:
docker pull nginx
Verify the image download:
docker images
- Search for Images
To explore more images available on Docker Hub:docker search nginx
For example, to pull an unofficial NGINX reverse proxy image:
docker pull jwilder/nginx-proxy
You are now ready to deploy containers using the images you downloaded.
Docker makes application deployment fast, scalable, and portable. For more details, check Docker’s official documentation or run:
man docker
This method provides a straightforward approach to installing and using Docker on Linux.
A Linux VPS Hosting solution gives you the flexibility to run Docker containers, manage application environments and scale your projects with confidence.