How to Install Docker on Linux Mint 21 Step-by-Step

In this blog post, we will show you how to install docker on Linux Mint 21 system step-by-step.

Docker is an open-source tool that allows developers and system administrators to package their applications along with all dependencies inside a docker image. Later this image can be distributed among team members and can run a container using this image where docker is installed.

Docker comes with community edition and enterprise edition. In this post, we will be installing docker community edition.

Prerequisites

  • Pre-Install Linux Mint 21 System
  • Sudo User with admin rights
  • Reliable Internet connection

Without any delay, let’s jump into docker installation steps.

1) Install Docker Dependencies

Open the terminal and run following apt commands to install docker dependencies.

$ sudo apt update
$ sudo apt install -y apt-transport-https ca-certificates curl gnupg

Install-Docker-Dependencies-Linuxmint21

2) Import Docker GPG Key

Run the following curl command to download and import docker gpg key into your linux mint 21.

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/dockerce.gpg

Docker-GPG-Key-LinuxMint21

3) Add Docker APT Repository on Linux Mint 21

Now, add the following apt repository for docker on your linux mint 21, run below echo command

$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/dockerce.gpg] https://download.docker.com/linux/ubuntu jammy stable" | sudo tee /etc/apt/sources.list.d/dockerce.list > /dev/null

Add-Docker-APT-Repository-LinuxMint21

Next, update the package index by executing beneath apt command.

$ sudo apt update

4) Install Docker on Linux Mint 21

As we have completed all prerequisites, now it’s time to install docker, run following apt command.

$ sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

This command will install latest version of community edition of docker.

Install-Docker-on-LinuxMint21-Apt-Command

Once the docker and other required packages are installed then verify the docker version and its service.

$ sudo docker version

Check-Docker-Version-LinuxMint21

$ sudo systemctl status docker

Docker-Service-Status-Check-LinuxMint21

Perfect, output above confirms that docker service is up and running.

5) Manage Docker with Local User

If you want your local user to manage docker then you need to the user to docker secondary group. Run following chmod command,

$ sudo usermod -aG docker $USER
$ newgrp docker

Now, you can run docker command without typing sudo in front of it.

6) Test Docker Installation

To ensure that Docker is installed correctly on your Linux Mint 21 system, you can run a container using hello-world image as shown below:

$ docker run hello-world

Docker-Run-Hello-World-LinuxMint21

This command will download hello-world image and run a container from it. If everything is set up properly, you will see an information message confirming that Docker is working correctly.

That’s all from this post, we believe you have found it informative and useful. Please do post your queries and feedback in below comments section.

Also Read: How to Install VirtualBox on Linux Mint 21 Step-by-Step

1 thought on “How to Install Docker on Linux Mint 21 Step-by-Step”

Leave a Comment