[英]Mysql Exited on Docker Container
I want to make a web development platform on MacOS by using Docker. 我想使用Docker在MacOS上构建Web开发平台。 I installed nginx, and php7-fpm container and they're running and communicating each other.
我安装了nginx和php7-fpm容器,它们正在运行并相互通信。 But after installing mysql container, mysql container was exited.
但是在安装mysql容器后,mysql容器已退出。 I don't know why it exited.
我不知道为什么退出。
This is docker ps -a output: 这是docker ps -a输出:
2955d2d5c392 nginx "/sbin/my_init" 38 seconds ago Up 36 seconds 0.0.0.0:8080->80/tcp dockertutorial_web_1
ec3c16795f05 php:7-fpm "docker-php-entrypoin" 38 seconds ago Up 37 seconds 9000/tcp dockertutorial_php_1
835e91ba927a mysql:latest "docker-entrypoint.sh" 38 seconds ago Exited (0) 37 seconds ago dockertutorial_mysql_1
As you can see, mysql was exited. 如您所见,mysql已退出。
This is my docker-compose.yml file: 这是我的docker-compose.yml文件:
web:
image: nginx
ports:
- "8080:80"
volumes:
- ./src/public:/var/www/public
- ./src/vhost.conf:/etc/nginx/sites-enabled/vhost.conf
links:
- php
php:
image: php:7-fpm
volumes:
- ./src/public:/var/www/public
links:
- mysql
mysql:
image: mysql:latest
ports:
- "3306:3306"
volumes:
- /var/lib/mysql
command: "true"
environment:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: project
MYSQL_USER: project
MYSQL_PASSWORD: project
Any suggesstion to solve it? 有什么建议要解决吗?
You are overriding command
for MySQL
image with true
which will be run instead of mysqld
. 您正在使用
true
覆盖MySQL
映像的command
,它将代替mysqld
运行。
Remove command: "true"
from docker-compose.yml
from mysql
service and it will start mysqld
. 从
mysql
服务docker-compose.yml
删除command: "true"
,它将启动mysqld
。
See this Dockerfile for reference. 请参阅此Dockerfile以获得参考。
https://github.com/docker-library/mysql/blob/c207cc19a272a6bfe1916c964ed8df47f18479e7/5.7/Dockerfile#L63 https://github.com/docker-library/mysql/blob/c207cc19a272a6bfe1916c964ed8df47f18479e7/5.7/Dockerfile#L63
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.