在以下位置完成教程:https://docs.docker.com/compose/wordpress/
运行docker compose我得到:
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
尝试添加此处建议的参数:https://github.com/docker-library/mysql/issues/186https网址:github.com/docker-library/mysql/issues/69
但这似乎行不通:
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
还有别的解决办法吗?
1条答案
按热度按时间i5desfxk1#
我用以下方法解决了这个问题:
删除所有未使用的本地卷。未使用的本地卷是指未被任何容器引用的卷
https://docs.docker.com/engine/reference/commandline/volume_prune/