How to Install Docker Community Edition on Linux Mint 19
As a full-time web developer, my daily task is to develop a website. Well, that's kinda obvious. But there are some skills required to support my main task:
- Sysadmin. Stuffs like
aptand so on.
- Networking. Utilities like
- A little hacking. Something like running MacOS on a non Mac devices.
Off course running my own server is fun, but there are times when I must spend a day or two to figure some misconfiguration. The application runs fine on my machine, but when it's deployed on server, something is broken. There's even a meme for this situation:
Well, ideally this shouldn't ever happened. It potentially waste our time as a developer. We should just focus on our development task and shouldn't troubleshooting server's environment.
Then I heard about this Docker container. My initial response is "Wow, this is what I'm looking for. Let's try it."
As published on Wikipedia, Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating-system kernel and are thus more lightweight than virtual machines.
The software that hosts the containers is called Docker Engine. It was first started in 2013 and is developed by Docker, Inc. Docker Engine is available in Community Edition (CE) and Enterprise Edition (EE). We'll cover the installation of Docker Community Edition on Linux Mint 19 using below steps.
Update Local Packages and Install Dependencies
First, make sure our packages are up-to-date. Then, install all the packages used by Docker as dependencies. Open up a terminal and type this command:
$ sudo apt update && sudo apt upgrade -y
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
Add Docker GPG Key and Repository
We need to add Docker GPG key used for signing Docker packages and add Docker upstream repository to our Linux Mint 19. This is necessary step so we can install the latest stable release of Docker.
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(. /etc/os-release; echo "$UBUNTU_CODENAME") stable"
Now is the main installation process. We will install the latest version of Docker CE and Docker Compose.
Update local package index:
$ sudo apt-get update
Then install the latest version of Docker CE and Docker Compose:
$ sudo apt install docker-ce docker-compose
Let's sit back and relax until this process completed. When it's completed, the
docker group is created but no users are added. To be able to use Docker, add our normal user to the group to run Docker commands as non-privileged user.
$ sudo usermod -aG docker $USER
To make this change effective, we need to log out and log back in so that our group membership is re-evaluated.
Next step is verify that our installation is successful. Let's 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
e6b0cf9c0882: Pull complete
Status: Downloaded newer image for alpine:latest
It should show a shell like this:
If it does, congratulations, we've successfully installed Docker Community Edition on our Linux Mint 19.
Well, that's it. I hope that you now know how to install Docker Community Edition on Linux Mint 19 (19 Tara, 19.1 Tessa, 19.2 Tina). If you run into any issues or have any feedback feel free to drop a comment below.