In this guide, you’ll learn how to install Docker on a Linux system and get started quickly, using Ubuntu Server 16.04 as an example.
Containers have become a vital part of IT due to their lightweight and efficient nature. They package everything needed to run an application — code, libraries, runtime, and dependencies — without requiring a full operating system like virtual machines do. This allows businesses to easily deploy scalable and resource-friendly services, such as multiple NGINX instances. Docker makes managing containers simple and works seamlessly with Linux.
Prerequisites
Ensure that your Ubuntu Server 16.04 is installed and running.
Follow the steps:
- System Update
As Ubuntu Server 16.04 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 docker
Log 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
- Search for Images
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 was the easiest way to Install and use Docker on Linux.