phpMyAdmin + MySQL docker-compose.yaml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
version: '3'

networks:
mysql-phpmyadmin:
name: mysql-phpmyadmin
driver: bridge

volumes:
mysqldata:
driver: local
driver_opts:
type: 'none'
o: 'bind'
device: '/home/duzhuo/docker/mysql/data'

services:
mysql:
image: mysql
container_name: mysql
environment:
MYSQL_ROOT_PASSWORD: 123456
MYSQL_DATABASE: database
MYSQL_USER: duzhuo
MYSQL_PASSWORD: 123456
ports:
- "33060:3306"
volumes:
- mysqldata:/var/lib/mysql
networks:
# Connect the mysql container to the mysql-phpmyadmin network and set the alias as mysql
mysql-phpmyadmin:
aliases:
- mysql

phpmyadmin:
image: phpmyadmin
container_name: phpmyadmin
links:
- mysql
environment:
PMA_HOST: mysql
PMA_PORT: 3306
ports:
- 8081:80
networks:
# Connect the phpmyadmin container to the mysql-phpmyadmin network and set the alias as phpmyadmin
mysql-phpmyadmin:
aliases:
- phpmyadmin