Home How to Deploy phpMyAdmin in Docker
Post
Cancel

How to Deploy phpMyAdmin in Docker

Requirements

Install docker

1
sudo apt install docker.io -y

Create Docker Network (optional)

1
docker network create {network-name}

Creating Docker Container

to create a file

1
nano docker-phpmyadmin.yaml

add content bellow to the file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
version: '3.1'

services:
  phpmyadmin:
    container_name: phpmyadmin
    image: phpmyadmin
    restart: always
    ports:
      - 8080:80
    environment:
      - PMA_HOST=mysql
      - PMA_ARBITRARY=1
    depends_on:
      - mysql
  
    db:
      image: mysql:latest
      container_name: mysql
      restart: always
      ports:
        - 3306:3306
      environment:
      MYSQL_ROOT_PASSWORD: <password for mysql>
1
docker-compose -f docker-phpmyadmin.yaml up 

Access phpmyadmin

To get the docker network gateway ip:

1
docker inspect phpmyadmin

In the output you will find gateway under ‘gateway:’

Go to the browser to access phyMyAdmin: http://localhost:8080/

The default user is ‘root’ and the password will the password set on docker-phpmyadmin.yaml

Because we are using phpmyadmin in docker we can’t use ‘localhost’. So in this case we are going to use docker network’s gateway ip

This post is licensed under CC BY 4.0 by the author.