Marcelle  Kunde

Marcelle Kunde


Docker-compose for MySQL with phpMyAdmin

Docker-compose is an useful utility for managing multi-container docker applications. In our previous tutorial, I had discussed about the keep persistent data of MySQL docker containers using Docker volumes. Once you launched a MySQL container can be connect via terminal directly. But the phpMyAdmin lovers may need the web interface for managing databases.

In this tutorial, you will learn to launch MySQL Docker containers along with phpMyAdmin docker container using docker-compose command.


This guide assumes that you have already done the followings:

  1. You have installed Docker service on your System
  2. Also, have configured docker-compose utility on your system

How to Create MySQL with phpMyAdmin Docker Container

phpMyAdmin is an most popular web application for managing MySQL database servers. In this tutorial, we just use an example of Docker container for MySQL and phpMyAdmin.

So first create a docker-compose.yml file on your system with the following content.


version: '3'

    image: mysql:5.7
    container_name: db
      MYSQL_ROOT_PASSWORD: my_secret_password
      MYSQL_DATABASE: app_db
      MYSQL_USER: db_user
      MYSQL_PASSWORD: db_user_pass
      - "6033:3306"
      - dbdata:/var/lib/mysql
    image: phpmyadmin/phpmyadmin
    container_name: pma
      - db
      PMA_HOST: db
      PMA_PORT: 3306
    restart: always
      - 8081:80

Save you file and close it.

#general articles #docker #docker-compose #mysql #phpmyadmin

Docker-compose for MySQL with phpMyAdmin