gpt4 book ai didi

docker - './docker-compose.yml', service 必须是映射,而不是 NoneType

转载 作者:IT老高 更新时间:2023-10-28 21:19:28 28 4
gpt4 key购买 nike

当我运行:COMPOSE_PROJECT_NAME=zk_test docker-compose up 时,出现错误提示

"ERROR: In file './docker-compose.yml', service must be a mapping, not a NoneType.".

这是我的 yml 文件:

version: '2'
services:
zoo1:
image: zookeeper
restart: always
container_name: zoo1
ports:
- "2181:2181"
environment:
ZOO_MY_ID: 1
ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888

zoo2:
image: zookeeper
restart: always
container_name: zoo2
ports:
- "2182:2181"
environment:
ZOO_MY_ID: 2
ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888

zoo3:
image: zookeeper
restart: always
container_name: zoo3
ports:
- "2183:2181"
environment:
ZOO_MY_ID: 3
ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888

示例图片:

Sample Image

最佳答案

YAML 依赖于缩进。这个

services:
zoo1:

是一个包含两个键的映射,它们都映射到 null(即 Python 中的 None)。

鉴于:

services:
zoo1:

是嵌套在映射中的映射。键 'services' 具有与键 zoo1 的映射作为值(同样具有值 null)。

关于docker - './docker-compose.yml', service 必须是映射,而不是 NoneType,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43452448/

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