简体   繁体   English

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

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

Trying to run this Docker Compose file produces an error:尝试运行此 Docker Compose 文件会产生错误:

In file './docker-compose.yml', volume must be a mapping, not an array.在文件 './docker-compose.yml' 中,卷必须是映射,而不是数组。

version: '3'
services:
        dbos:
                image: mysql:5.7
                volumes:
                        - mysql_storage_new:/var/lib/mysql
                restart: always
                environment:
                        MYSQL_ROOT_PASSWORD: rootpass
                        MYSQL_USER: arshit
                        MYSQL_PASSWORD: redhat
                        MYSQL_DATABASE: mydb

        wordpressos:
                image: wordpress:5.1.1-php7.3-apache
                restart: always
                depends_on:
                        - dbos
                ports:
                        - 8089:80
                environment:
                        WORDPRESS_DB_HOST: dbos
                        WORDPRESS_DB_USER: arshit
                        WORDPRESS_DB_PASSWORD: redhat
                        WORDPRESS_DB_NAME: mydb
                volumes:
                        - wp_storage_new:/var/www/html
volumes:
        - wp_storage_new:
        - mysql_storage_new:

The outer volumes key should not have an array as value but an object mapping.外部卷键不应该有一个数组作为值,而是一个 object 映射。 Here, you can also check the docs .在这里,您还可以查看文档

I would also consider bumping the version of this compose file to 3.8.我还会考虑将此撰写文件的版本提高到 3.8。

version: '3'
services:
        dbos:
                image: mysql:5.7
                volumes:
                        - mysql_storage_new:/var/lib/mysql
                restart: always
                environment:
                        MYSQL_ROOT_PASSWORD: rootpass
                        MYSQL_USER: arshit
                        MYSQL_PASSWORD: redhat
                        MYSQL_DATABASE: mydb

        wordpressos:
                image: wordpress:5.1.1-php7.3-apache
                restart: always
                depends_on:
                        - dbos
                ports:
                        - 8089:80
                environment:
                        WORDPRESS_DB_HOST: dbos
                        WORDPRESS_DB_USER: arshit
                        WORDPRESS_DB_PASSWORD: redhat
                        WORDPRESS_DB_NAME: mydb
                volumes:
                        - wp_storage_new:/var/www/html
volumes:
        wp_storage_new:
        mysql_storage_new:

暂无
暂无

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

相关问题 错误:在文件“ ./docker-compose.yml”中,卷必须是映射,而不是数组 - ERROR: In file './docker-compose.yml', volume must be a mapping, not an array MacOS-在文件'./docker-compose.yml'中,卷必须是映射,而不是数组 - MacOS - In file './docker-compose.yml', volume must be a mapping, not an array 在文件'./docker-compose.yml'中,服务'image'必须是映射而不是字符串 - In file './docker-compose.yml', service 'image' must be a mapping not a string 错误:在文件 './docker-compose.yml' 中,服务必须是映射,而不是 NoneType - ERROR: In file './docker-compose.yml', service must be a mapping, not a NoneType 错误:在文件“./docker-compose.yml”中,服务“volumes”必须是映射而不是数组 - ERROR: In file './docker-compose.yml', service 'volumes' must be a mapping not an array docker-compose 向上抛出错误错误:在文件“./docker-compose.yml”中,服务必须是映射,而不是 NoneType - docker-compose up throwing error ERROR: In file './docker-compose.yml', service must be a mapping, not a NoneType Docker撰写错误“在文件'./docker-compose.yml'中,服务'punjab'必须是映射而不是字符串。” - Docker compose error “In file './docker-compose.yml', service 'punjab' must be a mapping not a string.” './docker-compose.yml', service 必须是一个映射,而不是一个 NoneType - './docker-compose.yml', service must be a mapping, not a NoneType 错误:在文件'./docker-compose.yml'中,服务'build'必须是映射而不是字符串 - ERROR: In file './docker-compose.yml', service 'build' must be a mapping not a string 在文件'./docker-compose.yml'中,服务'proxy-nginx'必须是映射而不是字符串? - In file './docker-compose.yml', service 'proxy-nginx' must be a mapping not a string?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM