3 Ways to Install Docker Engine on Linux Mint

Learn the simple steps to install the Docker container on Linux Mint 20, 18, or any other versions you are using with the help of the command given below using the terminal.

What is Docker and what are the benefits?

Docker is a tool distributed under an open-source license that allows users to create and run container-based virtual machines. It uses containers as isolated environments in userspace that run at the operating system level and share the file system and system resources. The key idea behind creating and running Containers instead of full -fledge virtual machines using Virtualbox or Hyper-V is to have a virtual operating system but extremely light in weight that uses only a few resources as compared to conventional servers or VMs.

What are the key features?

The key feature of Docker is to provide a platform to easily create isolated containers or VMs. We can use it on any popular operating system such as Linux, macOS, or Windows operating system. It also provides compose that uses a YML configuration file for setting up multiple containers and services to run, with just a single command. Apart from this Docker offers a library of App Images to create containers. Whereas, if want, the users can also build their Images on it when building containerized environments to run their applications.

What components are there?

The main components of the Docker platform are Docker Engine –  to develop, assemble, deliver, and run applications.

The Docker engine further comprises

Docker daemon– it is a background application that manages and runs Docker images and containers; Docker Engine REST API – an interface used by applications to interact with the Docker daemon. Whereas the Docker client is a command-line program (CLI) that calls the Docker daemon’s API.  Docker Compose is used to define and run multi-container Docker applications by defining them in a YML configuration file.

Apart from it, Docker Desktop is also available for Windows to provide a GUI interface for managing containers.

How to Install Docker on Linux Mint using Terminal

#1st Method: Using Linux Mint repository:

1. Update Apt Repository

First, update the Linux Mint repository by running the system update command. This will make ensure that system will have the latest version of packages.

sudo apt update

 

2. Install Docker Engine on Linux Mint

The most stable version of Docker Engine and Compose are already available to install using the default base repository of Linux Mint. Well, it will be not the latest one instead extremely stable and ready for production use.

sudo apt install docker docker-compose docker-doc docker-registry docker.io

Install Docker Engine on Linux Mint

4. To Check version

Once the installation is completed let’s check the version:

docker --version

Docker Version

 

5. Add User to Docker Group

Well, after installing the Docker, your system user won’t be able to use the Docker command line without using “sudo” with it. To solve this problem simply add your current user to the Docker group.

sudo usermod -aG docker h2s

Note: Replace the h2s with your current system user.

sudo reboot

 

6. To test run hello-world container

Now, we can test whether the docker can pull images and run them in containers properly. For that, we can fetch the hello-world image.

sudo docker run hello-world

You will get the output like the given below:

Start Docker Container on Linux Mint

 

#2nd Method- For the latest version using Docker official repository

7. Install required tools

Your system may not have tools to add repository over HTTPS properly, hence to confirm just run the given command and it will install them if they are not there:

sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common

 

8. Add Docker Repository on Linux Mint

Those who want to install the latest version of Docker on Linux Mint have to add its official repository manually.

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

Note: Depending upon your Linux Mint-based Ubuntu version- replace focal with that. For example- the latest Linux Mint 20. x is based on it, hence we are using the focal repository.

 

9.  Run system update

To properly integrate the Docker’s official added repository run the system update command once. This will ensure that you will get the latest packages to install from the added repo,

sudo apt update

 

10. Install the latest version of Docker Engine for Linux Mint

Well, if you already have installed the Docker using the first method given in this article, then first remove the same using the given command:

sudo apt remove docker docker-compose docker-doc docker-registry docker.io

Install Docker:

sudo apt-get install docker-ce docker-ce-cli containerd.io

 

11. Check Docker Engine Version

Once the installation is completed, let’s check this time which version we have on our Linux Mint.

docker --version

You can see that, now we have the latest version and build on your computer system.

docker latest version on Linux mint

 

12. Run Docker without sudo

Well, like in the first method, if you are installing docker the first time then your current user will not be a part of the Docker group. Hence, first, we need to add our current user to the Docker group using the given command:

sudo usermod -aG docker h2s

Note: Replace the h2s with your current system user.

After that reboot your system:

sudo reboot

 

13. How to remove or Uninstall Docker Engine

The way we have installed the Docker, the same will be used to remove it. However, instead of using the ‘install‘ parameter this time we use ‘remove‘.

sudo apt-get install docker-ce docker-ce-cli containerd.io

 

#3rd Method Using Snap

Docker install using Snap

Although this is not the recommended one, yet, if anyone wants to install Docker using Snap then follow the given commands on your Linux Mint.

sudo rm /etc/apt/preferences.d/nosnap.pref
sudo apt update
sudo apt install snapd
sudo snap install docker

 

Conclusion

Here we have learned the two ways to install the latest or the most stable version of docker-engine on Linux Mint. You can use any of them as per your choice for creating Container-based virtual machines.

 

Other Articles:

Best way to install Docker on Ubuntu 20.04 Linux
How to install and use Rocky Linux Docker container
3 Ways to install Remmina remote desktop on Linux mint
Fix Linux mint 20 – Cannot add PPA
How to install Gnome Desktop on Linux Mint

 

 

One Response

  1. Brian Quinn March 12, 2022

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.