Quick Reference: Installing Docker on Mint 20.2

I’m making this as a quick reference for installing docker when I need it. See also my post about installing webmin.

Please don’t blindly paste shell commands into a terminal, do some research and understand what the commands do first.

Please do let me know of any mistakes in the below.

If you’re unfamiliar with what docker is, the overview page has a good of an explanation as any place:

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.

Docker overview

Well that explanation seems to emphasize development quite a lot, but docker can also be used just to separate an application for the rest of the OS and the OS from the application. Separating an instance of NextCloud from an instance Plex. And separating those from a host git repository. I also like that I can experiment with it on Windows as well as Linux.

Starting from a fresh installation of Linux Mint 20.2 Uma (LXCE version if that matters), this is the general list of commands to run to get docker up and confirmed installed.

TL;DR Edition

  1. First, run an apt-get update
    sudo apt-get update
  2. Then install the prerequisites of what we’ll need (the -y is so I don’t have to push ‘y’ multiple times during install, you can also leave it out)
    sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release -y
  3. Then, use curl to grab a signature and do some magic I may or may not understand (all one line)
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg –dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  4. For Mint 20.2 “Uma”, I have to use the equivalent Ubuntu code name, focal. So in my case the command is the following (again, all one line)
    sudo 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
  5. Now I’m ready to install docker
    sudo apt-get install docker-ce docker-ce-cli containerd.io -y
  6. Bonus step: test docker to confirm it’s installed correctly:
    sudo docker run hello-world
    (This should produce a welcome/it worked message at the console)

More Descriptive version

First thing is to run an update to make sure apt-get is ready:

sudo apt-get update

Then install some necessary packages:

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

(technically that -y is optional, just have to push y a few times if you don’t use it.

I know this is downloading something and piping it to something else but I’m not going to pretend to have any idea what this means. I’ll just go with it.

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

This next command is a little different from the official documentation for installing docker because the documentation uses an environment variable for the codename of the OS.

To find the proper codename, I performed a cat command on the official-package-repositories.list file, located in /etc/apt/soures.list.d directory:

cat  /etc/apt/soures.list.d/official-package-repositories.list

The contents of this file pointed to repositories for ubuntu focal.

Using this information, I modified the line in documentation to use focal rather that environment variable (this also should be one long line with no breaks).

sudo 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

The result of the above will create that docker.list file with the focal stable line in it. The contents can be verified with a cat:

cat  /etc/apt/soures.list.d/docker.list 

This would be a good time to do an update to make sure the package manager sees the docker repositories:

sudo apt-get update

Once that is done, install docker itself:

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

Assuming that went smoothly, try that test image from docker’s hub:

sudo docker run hello-world

Having went through all this, there’s also a “convenience script” that will install it for you. Which I haven’t tried but is probably easier.

Mint will keep prompting anyway, but it may be a good idea to use apt-get to upgrade everything after this. And actually autoremove and autoclean as well. Those are optional.

Bonus: Packages I immediately add with every fresh install of Linux

Here are a few of my favorite packages. Not all of them are really required. tmux for instance is a way to splitting a console screen up and git is a file revision tracking utility mainly used for source repositories. But it’s here as a reference.

  • vim
  • wget
  • tmux
  • openssh-server
  • cpu-checker
  • git

To put it all together:

sudo apt-get install vim wget tmux openssh-server cpu-checker git -y

References:

Install Docker Engine on Ubuntu: official documentation
Install docker with provided installation “convenience script” (which I haven’t yet tried)

One thought on “Quick Reference: Installing Docker on Mint 20.2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s