【问题标题】:MacOS - In file './docker-compose.yml', volume must be a mapping, not an arrayMacOS - 在文件 './docker-compose.yml' 中,卷必须是映射,而不是数组
【发布时间】:2019-03-17 03:32:50
【问题描述】:

我看到了针对类似错误的响应,但似乎没有任何解决方案可以解决对我有用的问题。

我有一个 wordpress 网站,已导入 docker following this tutorial。我已经把所有的东西都写到了我应该“docker compose up”的最后一部分,并且我得到了主题行中列出的错误。这是我的 .yml 文件:

version: "2"

services:
    db:
        image: mysql:5.6
        volumes:
            - db_data:/var/lib/mysql
        restart: always
        environment:
            MYSQL_ROOT_PASSWORD: somewordpress
            MYSQL_DATABASE: wordpress
            MYSQL_USER: wordpress
            MYSQL_PASSWORD: wordpress

    wordpress:
        depends_on:
            - db
        image: wordpress:latest
        ports:
            - "8000:80"
        restart: always
        environment:
            WORDPRESS_DB_HOST: db:3306
            WORDPRESS_DB_USER: wordpress
            WORDPRESS_DB_PASSWORD: wordpress
        volumes:
            - ./public_html/wp-content/themes/oceanwp:/var/www/html/wp-content/themes/oceanwp
            - ./public_html/wp-content/plugins:/var/www/html/wp-content/plugins
            - ./public_html/wp-content/mu-plugins:/var/www/html/wp-content/mu-plugins
volumes:
    - ./data:/docker-entrypoint-initdb.d

【问题讨论】:

    标签: wordpress docker


    【解决方案1】:

    我想知道为什么您的 yml 文件与 post 中的不同。 我在帖子中使用了 yml 文件,它确实有效。

    请记住,您不能在 docker-compose 中映射顶级卷,因此打击是非法的,请参阅 linklink 以获得更多帮助。 volumes: - ./data:/docker-entrypoint-initdb.d

    【讨论】:

      猜你喜欢
      • 2020-08-17
      • 2017-12-17
      • 2017-05-11
      • 2018-12-28
      • 2017-09-13
      • 2017-01-26
      • 1970-01-01
      • 2021-08-30
      • 2018-09-30
      相关资源
      最近更新 更多