我有一个Mysql Docker问题,当我运行我的docker-compose up命令时退出。Docker mysql即时退出
这里是我的docker-compose.yml文件:
version: "2"
services:
web:
build: ./app
links:
- "db-mongo:db-mongo"
- "db-mysql:db-mysql"
ports:
- "443:3000"
volumes:
- "./app:/src"
- "/src/.sass-cache"
- "/src/node_modules"
- "/src/lib"
db-mongo:
build: ./mongo
ports:
- "27017:27017"
volumes:
- "./mongo/db:/data"
db-mysql:
image: mysql
ports:
- "3306:3306"
volumes:
- "./mysql/db:/var/lib/mysql"
- "./mysql/log:/var/log/mysql"
- "./mysql/conf.d:/etc/mysql/conf.d"
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: testt
文件夹./mysql/db和./mysql/log是空的。
当运行docker-compose up,这里的输出:
db-mysql_1 | Initializing database
server_db-mysql_1 exited with code 1
当我运行docker ps -a: 0a5a7a643f18 MySQL的 “docker-entrypoint.sh” 10分钟前结束(1)8分钟前server_db-mysql_1
奇怪的是,如果我跑docker run -d --name=new-mysql -p 3306:3306 -v /var/www/server/mysql/db:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=password mysql它的工作原理...
这里的docker logs 97c -f输出:
Initializing database
Database initialized
MySQL init process in progress...
Warning: Unable to load '/usr/share/zoneinfo/Factory' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/posix/Factory' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/right/Factory' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
MySQL init process done. Ready for start up.
为什么我的docker-compose不能让我的mysql docker保持活动状态?我必须错过一些东西......帮助!谢谢
编辑:它似乎是我的conf.d文件夹这是一些问题,因为当我删除卷- "./mysql/conf.d:/etc/mysql/conf.d",server_db-mysql保持活着。
这里是mysql/conf.d/my.cnf文件内容:
[mysqld]
general_log_file = /var/log/mysql/mysql.log
general_log = 1
为什么该文件崩溃MySQL的?