Как установить docker linux mint

Install Docker and Docker Compose on Linux Mint 21

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 Docker 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:

Читайте также:  Open data files linux

Install Docker Compose on Linux Mint 21

You now have Docker Engine and Docker Compose installed on Linux Mint. Enjoy using containers to run your services.

YOU CAN SUPPORT OUR WORK WITH A CUP OF COFFEE

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.

Источник

How to Install Docker CE in Linux Mint 20

Docker is an open-source containerization technology that is designed to create, deploy and run container-based applications. In this article, you will learn how to install the Docker Community Edition (CE) on Linux Mint 20.

If you have any older version of docker already installed in your machine you have to remove it.

$ sudo apt-get remove docker docker-engine docker.io containerd runc

How to Install Docker in Linux Mint

Now there are three ways you can install Docker in Linux Mint.

  1. Setting up docker repository.
  2. Download and install the .deb package locally.
  3. Using Docker installation script.

1. Install Docker Using Repository

Using this method we will add the Docker repository to the apt package manager index and will install the docker from there. By default apt will not support HTTPS, you have to enable it.

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

Now add GPG key for docker.

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

Now add the stable repository. As per the official documentation, if you use Linux Mint and if you face any installation issue then replace $(lsb_release -cs) with your parent Ubuntu distribution. In my case, my parent ubuntu distribution will be focal.

echo \ "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ focal stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Update the repository and install the docker package using the below command.

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

2. Install Docker Manually Using Deb Package

In this method, we will download the .deb file and install it locally using the apt or dpkg command. Go to the docker index page from where you can download the .deb file. If you take a look at the below image there is no package for ulyana so I will download .deb from focal.

Читайте также:  Mount usb linux read only

List of Releases

You can go inside “ubuntu/dists/focal/pool/stable/amd64/” and download .deb package for the Docker Engine version you wish to install.

List of Docker Releases

Once you have downloaded the packages go inside the directory where the file is downloaded and run the following command.

$ sudo dpkg -i /home/karthick/downloads/package.deb

3. Install Docker Using Installation Script

In this method, you will install docker using a shell script which will take care of installing docker in your machine. This script will try to install the latest version that is released under the edge channel. If you already have docker installed in your machine, running this script will cause issues. Run the following command to download and run the script.

$ curl -fsSL https://get.docker.com -o get-docker.sh $ sudo sh get-docker.sh

How to Validate the Docker Installation

You can choose any of the three methods described in previous sections for installing docker. Once the installation is completed you can run the “hello-world” container to check if your installation is successful.

$ sudo docker run hello-world

Verify Docker Engine

To check the docker version run the following command.

$ docker --version $ docker version

Check Docker Engine Version

In Ubuntu-based distribution, docker will be automatically started and enabled to start during boot.

$ systemctl is-active docker $ systemctl is-enabled docker $ systemctl status docker $ systemctl start docker $ systemctl stop docker

How to Run Docker as a Normal User

Instead of binding with TCP socket docker binds with Unix socket which is accessible only by root. If you wish not to use sudo every time to work with docker then you can create a group called docker and add non-root users into the group.

$ sudo groupadd docker $ sudo usermod -aG docker karthick

Now open a new terminal and run the hello-world container without sudo. From the below image you can see I am able to successfully run the container without sudo privilege.

$ sudo docker run hello-world

Running Docker as Normal User

That’s it for this article. If you have any feedback use the comment section.

I am an Experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies. Founder of TecMint.com, LinuxShellTips.com, and Fossmint.com. Over 150+ million people visited my websites.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

7 thoughts on “How to Install Docker CE in Linux Mint 20”

Man, the article is misleading for the method to install docker manually through the deb package. I followed your instruction and went to the download site, went into ..focal/pool/stable/ location. There are a multitude of packages listed there. As per your article, “download .deb file of the version of docker engine you want to install”. Dude, I downloaded one deb file which was the latest date, I did ‘docker –version‘ which worked fine, but to my surprise when I did ‘sudo docker run hello-world‘ it says docker engine not running!! I thought, how, I just installed it as per your instruction, and wasted my time doing different commands. then from the docker docs, I saw YOU NEED TO DOWNLOAD MULTIPLE FILES FROM DOWNLOAD SITE AND THEN INSTALL EACH OF THEM. Dude, you didn’t even explain how many files (s) to download and install!! You mentioned “download .deb FILE“, see singular. Reply

Читайте также:  Linux команда make install

I used the install script successfully the first time through. After playing with the installation for a while. I thought it would be a good idea to clean up and start again with a clean slate. So: 1. I removed my docker installation with the remove docker instructions given at the beginning.
2. I ran the script again and it failed promptly with GPG errors. So figured the removal might not have been complete, and sure enough, there was a hidden folder .docker still present which I deleted, and for good measure, I deleted the get-docker.sh.
3. I got a fresh copy of the script. and tried again. This time I had execution privileges problems with the script. I recalled that I had had the same problem the first time through, and corrected it with chmod a+x.
4. Finally, the script ran as it should. I am not certain that what I did was proper, but I can proceed now. This script is great. In the process I explored the other two methods without success: With the first method, I kept having problems with GPG errors and so moved on to Method 2. where I was unable to find the .deb file you referred to. So I moved on to method 3, where I had success. Reply

Thank you so much for this! I’ve been trying to get Docker Desktop installed in Mint for a couple of days now and never could get it to work. I’ve searched and searched, followed guide after guide and none of them worked until I found yours, which finally allowed me to install Desktop. Reply

As a day-1 Linux Mint user (with no previous Linux experience), I’ve been rather impressed that this distro meets & often exceeds my previous Windows experience. Unfortunately, my self-taught CLI lessons have been less than stellar; at a rate of probably 20%, I run into errors after eliminating syntax issues, spelling, etc. Having followed the tutorial all the way through the “groupadd” section, I attempt to run the su-less “hello-world” command in docker & am met with: docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post “http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/create”: dial unix /var/run/docker.sock: connect: permission denied.
See ‘docker run –help’. Previous CLI obstacles I’ve encountered have almost always been either incorrect permissions or generating terminal commands from the wrong directory. I suspect the former is the case here after a perusal of the error message. However, I don’t know what directory or file requires permission or what permission it requires (x would be my guess). Reply

$ sudo chmod 666 /var/run/docker.sock

That absolutely solved it! Why wasn’t it in the tutorial? I would have been lost without this comment. Reply

Источник

Оцените статью
Adblock
detector