【问题标题】:mysql 5.7 data directory has files in itmysql 5.7 数据目录中有文件
【发布时间】:2018-11-29 21:15:26
【问题描述】:

按照以下教程进行操作: https://docs.docker.com/compose/wordpress/

运行 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

已尝试按照此处的建议添加参数: https://github.com/docker-library/mysql/issues/186 https://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

还有其他解决方案吗?

【问题讨论】:

  • 认为我可能已经使用 'docker volume prune' 解决了它,但不确定......
  • 请告诉我们你是怎么解决的,你
  • 我的硬盘驱动器上的 Docker 容器空间不足。使用修剪命令修复它:docs.docker.com/config/pruning

标签: mysql wordpress docker docker-compose


【解决方案1】:

我解决了这个问题:

docker volume prune

删除所有未使用的本地卷。未使用的本地卷是那些 未被任何容器引用

https://docs.docker.com/engine/reference/commandline/volume_prune/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-09-05
    • 2020-04-02
    • 2017-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-27
    • 2019-09-19
    相关资源
    最近更新 更多