Docker中部署Mysql5.7和DbAdmin的docker-compose.yml
Docker中部署Mysql5.7和DbAdmin的docker-compose.yml
一、简述
本文讲Docker通过docker-compose.yml部署Mysql5.7和dbAdmin的方法。
二、文件
1、docker-compose.yml内容如下:
version: '3'
services:
mysql57:
image: mysql:5.7
ports:
- 0.0.0.0:3306:3306
environment:
- MYSQL_ROOT_PASSWORD=password001!
volumes:
- /opt/mysql/data:/var/lib/mysql
deploy:
placement:
constraints:
- node.hostname==server1
restart_policy:
condition: on-failure
dbAdminer:
image: adminer
ports:
- 3307:8080
deploy:
placement:
constraints:
- node.hostname==server1
restart_policy:
condition: on-failure
2、在宿主机上创建数据目录,来存Mysql数据库。
mkdir /opt/mysql/data
3、执行启动创建部署
docker stack deploy -c docker-compose.yml mysql57
4、停止部署
docker stack rm mysql57
Docker中部署Mysql5.7和DbAdmin的docker-compose.yml
https://www.dearcloud.cn/2019/04/03/20200310-cnblogs-old-posts/20190403-Docker中部署Mysql5.7和DbAdmin的docker-compose.yml/