简体   繁体   English

MacOS-在文件'./docker-compose.yml'中,卷必须是映射,而不是数组

[英]MacOS - In file './docker-compose.yml', volume must be a mapping, not an array

I've seen responses for similar errors, but nothing that seems to address a solution that will work for me. 我已经看到了针对类似错误的回复,但是似乎没有什么能够解决对我有用的解决方案。

I've got a wordpress site that I've imported into docker following this tutorial . 本教程之后 ,我有一个wordpress网站已导入docker。 I've got everything down to the final part where I'm supposed to "docker compose up" and I'm getting the error listed in the subject line. 我已经把所有事情都归结到了我应该“码头工人组成”的最后一部分,并且在主题行中列出了错误。 Here is my .yml file: 这是我的.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

I was wondering why your yml file is different from the one in the post . 我想知道为什么您的yml文件与文章中的文件不同。 I use the yml file in the post and it does work. 我在帖子中使用yml文件,它确实起作用。

Remember that you can't map a top-level volume in docker-compose , so blow is illegal, see link and link for more help. 请记住,您无法在docker-compose中映射顶级卷,因此打击是非法的,请参阅链接链接以获取更多帮助。 volumes: - ./data:/docker-entrypoint-initdb.d

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:在文件“./docker-compose.yml”中,卷必须是映射而不是字符串 - ERROR: In file './docker-compose.yml', volume must be a mapping not a string 在CentOS上使用docker-compose.yml的Wordpress - Wordpress with docker-compose.yml on CentOS 如何使用NGINX,PHP-FPM在docker-compose.yml文件中加载mysqli扩展 - How to load mysqli extension inside docker-compose.yml file with NGINX, PHP-FPM 这个用于启动traefix,wordpress和mariadb容器的docker-compose.yml文件怎么了? - What's wrong with this docker-compose.yml file to start traefix, wordpress and mariadb containers? 为什么我需要在 docker-compose.yml 中显式声明 env_file? - Why do I need to declare env_file explicitely in docker-compose.yml? 如何在现有的 WordPress git 存储库中配置新的 docker-compose.yml 文件? - How do I configure a new docker-compose.yml file in an existing WordPress git repository? 如何在 docker-compose.yml 中运行 wp cli - How to run wp cli in docker-compose.yml 端口可用于在 docker-compose.yml 中设置 mysql 和 wordpress - Port available to set in docker-compose.yml for mysql and wordpress Node.js 未在 Docker 中运行,我的 docker-compose.yml 是否正确? - Node.js is not running in Docker is my docker-compose.yml correct? Docker 撰写卷权限 linux - Docker compose volume Permissions linux
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM