How can I install Docker CE on Linux Mint 21?, How can I install Docker Compose on Linux Mint 21?. This guide will answer above questions by showing you a step by step installation of Docker and Docker Compose on Linux Mint.
Docker has been the defacto container engine since its arrival. It enables you to package and run your applications in isolated containers within a single host or cluster of Linux hosts.
Docker Engine is available in Community Edition (CE) and Enterprise Edition (EE). In this guide, we will do the installation of Docker Community Edition on Linux Mint using below steps.
Step 1: Install Dependency packages
Start the installation by ensuring that all the packages used by docker as dependencies are installed.
sudo apt update
sudo apt -y install apt-transport-https ca-certificates curl software-properties-common
sudo apt -y remove docker docker-engine docker.io containerd runc
Step 2: Add Docker’s official GPG key
Import Docker GPG key used for signing Docker packages.
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Step 3: Add the Docker repository
Add Docker upstream repository to your Linux Mint 21 so you can install the latest stable release of Docker.
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu jammy stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
The command above will add a new line to additional repositories file.
$ cat /etc/apt/sources.list.d/docker.list
deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu jammy stable
Step 4: Install Docker Engine and Compose
Update the apt
package index.
$ sudo apt update
Hit:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
Get:2 https://download.docker.com/linux/ubuntu jammy InRelease [48.9 kB]
Get:3 https://download.docker.com/linux/ubuntu jammy/stable amd64 Packages [7,756 B]
Hit:4 http://archive.ubuntu.com/ubuntu jammy InRelease
Ign:5 http://packages.linuxmint.com vanessa InRelease
Hit:6 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:7 http://packages.linuxmint.com vanessa Release
Hit:8 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Fetched 56.6 kB in 1s (112 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Then install the latest version of Docker CE and Docker Compose
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
The docker
group is created but no users are added. Add your normal user to the group to run docker commands as non-privileged user.
sudo usermod -aG docker $USER
newgrp docker
Check the version of docker installed
$ docker version
Client: Docker Engine - Community
Version: 20.10.19
API version: 1.41
Go version: go1.18.7
Git commit: d85ef84
Built: Thu Oct 13 16:46:58 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.19
API version: 1.41 (minimum version 1.12)
Go version: go1.18.7
Git commit: c964641
Built: Thu Oct 13 16:44:47 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.8
GitCommit: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Run a test docker container:
$ docker run --rm -it --name test alpine:latest /bin/sh
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
213ec9aee27d: Pull complete
Digest: sha256:bc41182d7ef5ffc53a40b044e725193bc10142a1243f395ee852a8d9730fc2ad
Status: Downloaded newer image for alpine:latest
/ # cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.16.2
PRETTY_NAME="Alpine Linux v3.16"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
/ # exit
jkmutai@mint21:~$
You now have Docker Engine and Docker Compose installed on Linux Mint. Enjoy using containers to run your services.
Also relevant is Top command for container metrics
More on Docker: