Docker has become an indispensable tool for developers, offering containerized applications that can be effortlessly distributed and executed. However, installation on Linux Mint, especially the latest versions, can sometimes be a hurdle. In this guide, we'll demonstrate how to successfully set up Docker on Linux Mint 21.2 "Victoria" using the official Docker script with a minor modification.
Prerequisites:
- Linux Mint 21.2 "Victoria".
- Internet connection.
- Terminal and basic command-line operations knowledge.
Using Docker's Installation Script with Modifications
Docker provides an installation script that makes setting it up on various Linux distributions easier. However, we'll need to adjust the script slightly for Linux Mint 21.2 "Victoria".
Step 1: Download the Script
curl -fsSL https://get.docker.com -o get-docker.sh
Step 2: Modify the Script for Linux Mint 21.2 "Victoria"
Open the script in Visual Studio Code (or your preferred editor):
code get-docker.sh
Locate the section that identifies the distribution (something like this in September 2023)
lsb_dist=$(lsb_release -a -u 2>&1 | tr '[:upper:]' '[:lower:]' | grep -E 'id' | cut -d ':' -f 2 | tr -d '[:space:]')
and after that line add:
if [ "$lsb_dist" = "mint" ]; then
dist_version="jammy"
fi
Save the file and exit. With this code the repositories we are going to grab are the ones for jammy (ubuntu 22.04 LTS, the version from where Linunx Mint 21.2 "Victoria" comes from. This is the real trick on all the process.
Step 3: Execute the Script
sudo sh get-docker.sh
Note: Always review any script from the internet before executing it. You've made a modification, but it's a good habit to inspect any external scripts.
Step 4: Add Your User to the Docker Group
This allows you to run Docker commands without needing sudo.
sudo usermod -aG docker ${USER}
Log out and back in for these changes to take effect, or run:
newgrp docker
Verifying Docker Installation
Verify that Docker is installed and running with:
sudo systemctl status docker
Test Docker Installation
Run a test Docker container to ensure proper setup:
sudo docker run hello-world
Conclusion
You now have Docker up and running on Linux Mint 21.2 "Victoria"! With a minor modification to Docker's script, you've tailored the installation to your specific OS version, paving the way for seamless containerization tasks ahead.