Docker is an Open Source platform for development, deploy and application execution. You need to install it to execute on operating systems. In this article we will see how to install and configure in Linux Debian: Mint and Ubuntu based distributions.
Docker allows you to separate apps from your infrastructure so you can quickly deploy your softwares on servers. With Docker, you can manage your infrastructure just as it manages your applications. By taking advantage of Docker’s methodologies to build, test and deploy code quickly, you can significantly reduce the delay between writing the code and executing it in production.
If you use PHP and Laravel for the development of your applications, an excellent option to use Docker with Laravel is the Laradock project. After completing the Docker installation on your Linux Mint or Ubuntu system, read the blog articles that teach you how to use Laradock.
Installing Docker in Linux Mint and Ubuntu
I describe the steps required to install Docker on Linux Mint using official repositories -which is similar to installation in Ubuntu or Debian derivatives:
- Add the libraries from APT repositories:
sudo apt-get update sudo apt-get install \ ca-certificates \ curl \ gnupg \ lsb-release
- Add Official GPG Keys of Docker
sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
- Configure the repository, you can use the following command
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
It is now necessary to correct the Linux release name of the MINT version for the Ubuntu version in the Source file. This is necessary because Mint is based on Ubuntu and Docker does not provide APT source for Mint. If you run a
apt update before the correction you will see the following error:
The repository 'https://download.docker.com/linux/ubuntu una Release' does not have a Release file.
Enter the following command to check the uptream version:
sudo cat /etc/upstream-release/lsb-release # Outpu example # DISTRIB_ID=Ubuntu # DISTRIB_RELEASE=20.04 # DISTRIB_CODENAME=focal # DISTRIB_DESCRIPTION="Ubuntu Focal Fossa"
In the example above the result in my Linux Mint version for Ubuntu is
focal. Now you need to change the name in the Docker source Apt file:
sudo nano /etc/apt/sources.list.d/docker.list
focal in the following line within the file:
deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu focal stable
Now just install
sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-compose
- Test the installation
sudo docker run hello-world
Now we are ready to install the packages of our languages, databases and other tools in Doker containers without having to “pollute” the installation of the operating system, as well as having the advantage of start and stop services when needed and use different versions of interface languages or programming languages for each project.
Solving installation problems with Docker
Some common problems with Docker may have their solutions found in the following articles: