Docker Compose helps you run multi-container apps using a simple configuration file. Here’s how you can install Docker Compose on Linux.
Docker and Docker Compose are staples for the Linux self-hosting community, allowing easy installation of the apps which can run your sites and services. Stable versions of both Docker and Docker Compose are simple to install. Here’s how to install them on any Linux platform.
Install Docker and Docker Compose
Before you start, make sure that all packages on your Linux system are up-to-date. Then open a new terminal window.
Docker Compose is an easy way of managing Docker containers, so it makes sense that you will need to install Docker first. The exact command varies depending on your distro.
If you’re using Debian or Ubuntu:
sudo apt install docker.io
For installation on Fedora:
sudo dnf install docker
If you use Arch (BTW):
sudo pacman -S docker
Docker is now installed on your system. Start and enable it with:
sudo systemctl start docker
sudo systemctl enable docker
Now add your user to the docker group:
sudo usermod -aG docker username
Your membership in the docker group won’t take effect immediately. You’ll need to log out and then log back in again before your user can use Docker without using sudo.
Installing Docker Compose is just as simple.
sudo dnf install docker-compose
On Debian and its derivatives:
sudo apt install docker-compose
Arch Linux users can run:
sudo pacman -S docker-compose
That’s all there is to it. You now have both Docker and Docker Compose installed on your Linux PC or server, and are ready to run projects such as PiGallery2—a directory-first web-facing image gallery, designed for the Raspberry Pi, but suitable for any Linux setup.
Learn to Use Docker Compose
Docker and Docker Compose offer a super-simple solution for downloading and running thousands of different projects together with all their dependencies. Although Docker Compose is often used for web-facing projects, there are plenty of local projects you can do, too.
Make sure you learn all the Docker Compose commands so that you can deploy them properly.