Difficulty: Beginner
Estimated Time: 10 minutes

When working with multiple containers, it can be difficult to manage the starting along with the configuration of variables and links. To solve this problem, Docker has a tool called Docker Compose to manage the orchestration of launching of containers.

In this scenario, you will run Adminer which is a tool for managing content in MySQL databases. Adminer is distributed under Apache license in a form of a single PHP file. The application uses the Flask framework and maintains a hit counter in Redis. While the sample uses Python, the concepts demonstrated here should be understandable even if you’re not familiar with it.

In this scenario, we explored how you can use Docker Compose to manage the orchestration of multi-container applications.

Don’t stop now! The next scenario will only take about 10 minutes to complete.

Advanced Docker Compose

Step 1 of 7

Step 1 - Defining First Container

Play databases with Adminer and Docker. When you use Docker with a database you need a client to operate on it. A simple and clean solution is to install a client in a Docker container. With that, no need to install anything on your computer besides Docker. Many clients exists, like PHPMyAdmin, but we want one that can connect to different database, not just MySQL/MariaDB.

Task : Defining Adminer Container

To complete this task, you need to copy the following code:

version: '3'
services:
    adminer:
        image:   adminer
        restart: always
        ports:
            - '8080:8080'

  • This tells docker to create service named adminer and use docker image adminer:latest.
  • Host port 8080 is mapped to container port 8080.
  • Container will be restarted in case of failure.
Dockerfile
docker-compose.yml