gpt4 book ai didi

docker - docker-compose.yml无效类型

转载 作者:行者123 更新时间:2023-12-02 18:15:21 27 4
gpt4 key购买 nike

docker-compose.yml

version: '2.0'
services:
asdf-db:
container_name: asdf-db
build: ./asdf/db
ports:
- 5435:5432 # expose ports - HOST:CONTAINER
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
healthcheck:
test: exit 0

asdf-service:
container_name: asdf-service
build: ./
volumes:
- '.:/usr/src/asdf'
ports:
- 5001:5000 # expose ports - HOST:CONTAINER
environment:
- APP_SETTINGS=asdf.config.DevelopmentConfig
- DATABASE_URL=postgres://postgres:postgres@asdf-db:5432/asdf_dev
- DATABASE_TEST_URL=postgres://postgres:postgres@asdf-db:5432/asdf_test
depends_on:
asdf-db:
condition: service_healthy
links:
- asdf-db

当我运行 docker-compose up -d时,出现以下错误消息:
ERROR: The Compose file '.\docker-compose.yml' is invalid because:
Unsupported config option for services.asdf-db: 'healthcheck'
services.asdf-service.depends_on contains an invalid type, it should be an array

我尝试将版本切换到2.1,然后收到以下错误消息:
ERROR: The Compose file '.\docker-compose.yml' is invalid because:
services.asdf-service.depends_on.links contains ["asdf-db"], which is an invalid type, it should be an object

如何将asdf-db更改为对象?

最佳答案

Healthcheck已添加到2.1中,因此您至少需要该版本。

在2.1版本中,您在links中包含depends_on,而它应该处于同一级别。

关于docker - docker-compose.yml无效类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47319239/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com