This Docker Compose tutorial explains how to Install Docker Compose on Debian 10. How to Install and Use Docker Compose on Debian 10 Linux. How to install the latest version of Docker Compose on Debian 10, Buster. Docker Compose is a tool that allows you to define and orchestrate multi-container Docker applications
Docker is a containerization platform that allows you to quickly build, test, and deploy applications as portable, self-sufficient containers that can run virtually anywhere.
Docker Compose is a tool that allows you to define and orchestrate multi-container Docker applications. It uses a YAML file to configure the application's containers, networks, and volumes.
Compose can be used for various purposes. Single host application deployments, automated testing, and local development are the most popular use cases for Docker Compose.
This tutorial explains how to install the latest version of Docker Compose on Debian 10, Buster. We'll also explore the basic Docker Compose concepts and commands.
The Docker Compose installation package is available in the official Debian 10 repositories, but it may not always be the latest version. The recommended approach is to install Docker Compose from the Docker's GitHub repository.
At the time of writing this article, the latest stable version of Docker Compose is version
1.23.1. Before downloading the Compose binary, visit the Compose repository release page on GitHub and check if there is a new version available for download.
Use the following steps to install the latest version of Docker Compose on Debian 10:
Download the Docker Compose binary into the
/usr/local/bin directory with
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod to make the Compose binary executable:
sudo chmod +x /usr/local/bin/docker-compose
To verify the installation, use the following command which prints the Compose version:
The output will look something like this:
``` docker-compose version 1.23.1, build b02f1306 ```
In this section, we will show how to set up a local WordPress development environment with Docker Compose.
Create a directory for the project and navigate into it
mkdir wordpress_app && cd wordpress_app
Open your text editor and create a file named
Paste the following content:
version: '3.7' services: db: image: mysql:8.0 command: --default-authentication-plugin=mysql_native_password restart: always volumes: - db_data:/var/lib/mysql environment: MYSQL_ROOT_PASSWORD: password MYSQL_DATABASE: wordpress wordpress: image: wordpress restart: always volumes: - ./wp_data:/var/www/html ports: - "8080:80" environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_NAME: wordpress WORDPRESS_DB_USER: root WORDPRESS_DB_PASSWORD: password depends_on: - db volumes: db_data: wp_data:
Let's explain the code line by line
The first line specifies the Compose file version. There are several different versions of the Compose file format with support for specific Docker releases.
Next, we are defining two services,
wordpress. Each service creates a separate container when Docker Compose is run.
mysql:8.0image. If the image is not present, Compose will pull it from the Docker Hub public repository. The line starting with
commandoverrides the default command.
restart: alwayspolicy instructs Compose to restart the container if it goes down.
db_datato persist the database.
wp_datadirectory on the host to
/var/lib/mysqlinside the container.
80on the container to port
8080on the host machine.
depends_oninstruction defines the dependency between the two services. In this example,
dbwill be started before
From the project directory, start up the WordPress stack by running the following command:
The output should look something like this:
... ] /usr/sbin/mysqld: ready for connections. Version: '8.0.18' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL. db_1_99946702ac7e | 2019-12-15T21:37:29.109255Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060 ...
Docker Compose will pull the images, start the containers, and create the
wp_data directory in your project directory.
http://0.0.0.0:8080/ in your browser, and you will see the standard WordPress installation screen.
At this point, the WordPress application is up and running, and you can start working on it.
To stop Compose press
You can also start the Compose in a detached mode by using the
docker-compose up -d
To view the running docker containers use the following command:
Name Command State Ports ------------------------------------------------------------------------------------------------------ wordpress_app_db_1_99946702ac7e docker-entrypoint.sh --def ... Up 3306/tcp, 33060/tcp wordpress_app_wordpress_1_a428d8408817 docker-entrypoint.sh apach ... Up 0.0.0.0:8080->80/tcp
To stop the services when Compose is running in detached mode, use:
If you want to remove the containers entirely use the
--volumes switch also remove the data volumes:
docker-compose down --volumes
If you need to uninstall Docker Compose you can simply remove the binary by typing:
sudo rm /usr/local/bin/docker-compose
To install Docker Compose on a Debian 10, simply download the binary in a directory in the system path and make it executable.
If you have any questions, please leave a comment below.
Docker is a containerization platform that allows you to quickly build, test and deploy applications as portable, self-sufficient containers that can run virtually anywhere. In this tutorial we'll explain how to install Docker on Debian 10 Buster.
The docker manifest command does not work independently to perform any action. In order to work with the docker manifest or manifest list, we use sub-commands along with it. This manifest sub-command can enable us to interact with the image manifests. Furthermore, it also gives information about the OS and the architecture, that a particular image was built for. The image manifest provides a configuration and a set of layers for a container image. This is an experimenta
Following the second video about Docker basics, in this video, I explain Docker architecture and explain the different building blocks of the docker engine; docker client, API, Docker Daemon. I also explain what a docker registry is and I finish the video with a demo explaining and illustrating how to use Docker hub.
What is DevOps? How are organizations transitioning to DevOps? Is it possible for organizations to shift to enterprise DevOps? Read more to find out!
There’s no doubt that Debian is one of the most popular distributions, especially among desktop enthusiasts and professionals alike. This guide features some of the most popular and widely used Debian-based Linux distributions.