Docker is considered as PaaS (platform as a service) software which makes use of OS level virtualization feature to spin up containers. In other words, we can say Docker provides container run time environment.
In this guide, we will cover to install Docker (Community Edition) on Ubuntu 22.04 (Jammy Jellyfish) and Ubuntu 20.04 (Focal Fossa) LTS. Installation steps of Docker for these Ubuntu versions are same.
Minimum System Requirement for Docker
- Pre-Installed Ubuntu 22.04 / 20.04
- 2 GB RAM or More
- 2 CPU cores or more
- 20 GB hard disk
- Sudo User with privileges
- Internet Connectivity
Without any further ado, let’s jump into the installation steps,
Step 1) Install docker dependencies
Open the terminal and run following commands to install docker dependencies,
$ sudo apt update $ sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
Step 2) Enable Docker Repository
In default package repositories of Ubuntu 22.04 / 20.04, Docker package is available, but it is recommended to install latest and stable version docker from their official repository. So run beneath commands to import keys and enable Docker repository,
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg $ echo "deb [arch=$(dpkg --print-architecture) 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 3) Install docker Engine
The system on which docker is installed, it also called as docker engine. So, to install docker, run
$ sudo apt-get update $ sudo apt-get install docker-ce docker-ce-cli containerd.io -y
Once the docker is installed, verify it’s service
$ sudo systemctl status docker
If you want local user to use docker command without sudo, then add that user to docker group, run
$ sudo usermod -aG docker $USER $ newgrp docker
Note: To use docker command without sudo, logged and login
$ docker version
Step 4) Test docker Installation
To test docker installation, try to spin up ‘hello-world’ container using following docker command,
$ docker run hello-world
Above output confirms that docker installation is working correctly. That’s all from this guide, please share your queries and feedback in below comments section.
Also Read: How Set or Change Time Zone in Linux