When I ran: COMPOSE_PROJECT_NAME=zk_test docker-compose up
, I got error saying
"ERROR: In file './docker-compose.yml', service must be a mapping, not a NoneType.".
This is my yml file:
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 is indentation dependent. This
services: zoo1:
is a mapping with two keys that both map to null
(i.e. None
in Python).
Whereas:
services: zoo1:
is a mapping nested in a mapping. The key 'services' has as value a mapping with key zoo1
(which again has a value null
).
version: '2' services: autodiscovery: build: ./autodiscovery/ mem_limit: 128m expose: - 53 - 8300 - 8301 - 8302 - 8400 - 8500 ports: - 8500:8500 dns: - 127.0.0.1
just put one space. before.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With