Question: Docker-Compose.yaml error: yaml.parser.ParserError: while parsing a block mapping
in "./docker-compose.yml", line 3, column 3
expected <block end>, but found '<block mapping start>'
in "./docker-compose.yml", line 17, column 5
Login to See the Rest of the Answer
Answer: When defining multiple Services in one single docker-compose.yaml you have to make sure that the Services are defined one after the other.
1. Pay attention to the positioning of blocks of code under one specific Service See the Code below:
version: "3.2" services: nameOfServiceHere: image: "theImageYouWant" container_name: the-name-you-want ports: - "portOnHost:portOnDockerContainer" environment: - Key=valueOfKey restart: always volumes: - /muiltTheVolumeHere another-Service-Name-here: image: "ImageHere" container_name: name-of-container ports: - "port:port" environment: - Key=value - Key="value" restart: always volumes: - /BindVolume another-service: image: "image" container_name: containername ports: - "port:port" environment: - Key=value restart: always volumes: - /Directory volumes: yourdata: