How can I install Docker CE on Ubuntu 22.04|20.04|18.04 Linux distribution. Docker Engine is a container runtime engine which allows you to package your applications with all of its dependencies into a standardized unit for software development and distribution.
The Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in.
Let’s install Docker CE on Ubuntu 22.04|20.04|18.04 by following the few steps below.
Step 1: Update System
Ensure your system is updated.
sudo apt -y update
Step 2: Install basic dependencies
There are few dependencies we need to configure Docker repositories and do the actual package installation. Install them by firing the following commands in your terminal.
sudo apt -y install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
Step 3: Install Docker CE
If you have older versions of Docker, remove it and its dependent packages.
sudo apt remove docker docker-engine docker.io containerd runc
Import Docker repository GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/docker-archive-keyring.gpg
You can then add Docker CE repository to Ubuntu
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Finally install Docker CE on Ubuntu:
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
Add your user account to docker group.
sudo usermod -aG docker $USER
newgrp docker
Verify installation by checking Docker version:
$ docker version
Client: Docker Engine - Community
Version: 23.0.6
API version: 1.42
Go version: go1.19.9
Git commit: ef23cbc
Built: Fri May 5 21:18:13 2023
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 23.0.6
API version: 1.42 (minimum version 1.12)
Go version: go1.19.9
Git commit: 9dbdbd4
Built: Fri May 5 21:18:13 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.21
GitCommit: 3dce8eb055cbb6872793272b4f20ed16117344f8
runc:
Version: 1.1.7
GitCommit: v1.1.7-0-g860f061
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Step 4: Install Docker Compose
Installation of Docker Compose is optional. For those using it, follow our guide below to install.
More articles:
- Install Docker UI manager – Portainer
- Ctop – Top command for container metrics
- How to Setup Docker Private Registry on Ubuntu with Letsencrypt
- Install and Configure Docker Registry on CentOS 7
- How To Deploy Lightweight Kubernetes Cluster in 5 minutes with K3s