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
宋兴柱:转载内容,请标明出处,谢谢!源文来自 宝贝云知识分享:https://www.dearcloud.cn