[英]mysql 5.7 data directory has files in it
Following the tutorial at: https://docs.docker.com/compose/wordpress/ 按照以下教程进行操作: https : //docs.docker.com/compose/wordpress/
Running docker-compose up I get: 运行docker-compose up我得到:
Initializing database
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[ERROR] --initialize specified but the data directory has files in it. Aborting.
[ERROR] Aborting
Have tried adding arguments as suggested here: https://github.com/docker-library/mysql/issues/186 https://github.com/docker-library/mysql/issues/69 尝试按照此处的建议添加参数: https : //github.com/docker-library/mysql/issues/186 https://github.com/docker-library/mysql/issues/69
But this doesn't seems to work: 但这似乎不起作用:
services:
db:
image: mysql:5.7
command: ["mysqld", "--ignore-db-dir=lost+found", "--explicit_defaults_for_timestamp"]
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
Is there another solution? 还有其他解决方案吗?
I solved it using: 我使用以下方法解决了问题:
docker volume prune
Remove all unused local volumes.
删除所有未使用的本地卷。 Unused local volumes are those which are not referenced by any containers
未使用的本地卷是任何容器都未引用的卷
https://docs.docker.com/engine/reference/commandline/volume_prune/ https://docs.docker.com/engine/reference/commandline/volume_prune/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.