logo
. . .

How to Install Docker on Ubuntu

Introduction

Docker is an application that simplifies the process of managing application processes in containers. Containers let you run your applications in resource-isolated processes. They’re similar to virtual machines, but containers are more portable, more resource-friendly, and more dependent on the host operating system.

Prerequisites

To follow this tutorial, you will need the following:
One Ubuntu 22. x server is set up by following the Ubuntu 22. x initial server setup guide, including a sudo non-root user and a firewall.
An account on Docker Hub if you wish to create your images and push them to Docker Hub.

For further information regarding best linux vps in india ,cloud server cost in india,cheap cloud hosting india provider, please contact us directly.

To install and use Docker on Ubuntu, you can follow these steps:

Step 1: Update Package Lists.
Make sure your package lists are up-to-date by running:
#sudo apt update

Step 2: Install Necessary Dependencies
#sudo apt install apt-transport-https ca-certificates curl software-properties-common

Step 3: Add Docker GPG Key.
Curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg –dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Step 4: Set Up Stable Docker Repository
echo “deb [signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable” | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Step 5: Install Docker Engine
#sudo apt update
#sudo apt install docker-ce docker-ce-cli containerd.io

Step 6: Manage Docker as a Non-Root User (Optional)
If you want to avoid using sudo each time you run Docker commands, add your user to the docker group:
#sudo usermod -aG docker $USER
After running this command, you will need to log out and log back in or restart your system for the changes to take effect.

Step 7: Verify Installation
#docker –version
#docker run hello-world
The docker run hello-world command should download a test image and run a simple container, confirming that your Docker installation is working correctly.

That’s it! You have successfully installed Docker on Ubuntu. You can now start using Docker to build, ship, and run containerized applications.