postgresql - 错误:Compose 文件“.\docker-compose.yml”无效,因为:services.drupal 的配置选项不受支持:“postgres”
问题描述
这是我的 docker-compose.yml:
version: "3"
services:
drupal:
image: drupal
ports:
- "8080:80"
volumes:
- drupal-modules:/var/www/html/modules
- drupal-profiles:/var/www/html/profiles
- drupal-sites:/var/www/html/sites
- drupal-themes:/var/www/html/themes
postgres:
image: postgres
environment:
- POSTGRES_PASSWORD=mypasswd
volumes:
drupal-modules:
drupal-profiles:
drupal-sites:
drupal-themes:
当我跑步时
$ docker-compose up
我得到:
ERROR: The Compose file '.\docker-compose.yml' is invalid because:
Unsupported config option for services.drupal: 'postgres'
有什么问题?
解决方案
你的缩进docker-compose.yml
是不正确的,因为.yml
文件是缩进敏感的。
你有三个错误:
ports
是一个key:value
数据,所以-
应该在下一行缩进。volumes
是一个key:value
数据,所以-
应该在下一行缩进。postgres
服务的缩进应该与drupal
.
所以你的文件应该看起来像这样才能工作:
version: "3"
services:
drupal:
image: drupal
ports:
- "8080:80"
volumes:
- drupal-modules:/var/www/html/modules
- drupal-profiles:/var/www/html/profiles
- drupal-sites:/var/www/html/sites
- drupal-themes:/var/www/html/themes
postgres:
image: postgres
environment:
- POSTGRES_PASSWORD=mypasswd
volumes:
drupal-modules:
drupal-profiles:
drupal-sites:
drupal-themes:
推荐阅读
- ios - tel:// 方案自动格式化电话号码
- php - 如何从 opencart3 管理面板中的 MySQL Query 获取另一列值?
- android - 单击按钮时没有出现 ImageView
- linux - Unity:Linux 上所有网格过滤器上缺少网格
- azure - 如何使用 Powershell 7 将保留的 IP 地址分配给 Azure 上的云服务?
- android - 杀死带有 ContentProvider 代码的应用程序时无法找到 ContentProvider 信息
- parsing - 从 Scrapy 蜘蛛类中的另一个文件调用 HTML 标签并解析它们
- javascript - 使用 html-dock-js-typescript 生成的 word 文件中的问题
- c# - 如何让单人游戏中的角色走在特定的路线上?
- python-3.x - Python(3.x): print(string , end='') 导致突出显示模符号 %