Why this is not working on docker compose version 3?
nginx:
image: nginx
container_name: nginx
environment:
VIRTUAL_HOST: >
proj1.local,proj2.local,
proj3.local,proj4.local,proj5.local
I've a lot of virtual hosts and I need to go multilne but I receive:
ERROR: yaml.scanner.ScannerError: while scanning a simple key
in "./docker-compose.yml", line 31, column 7
could not find expected ':'
in "./docker-compose.yml", line 32, column 7
What am I doing wrong?
Tools such as Yamllint are your friend when seeing those types of errors. That said, it sometimes doesn't give you a meaningful error when failing validation.
What you have in the example is an indentation problem. You should be using:
nginx:
image: nginx
container_name: nginx
environment:
VIRTUAL_HOST: >
proj1.local,proj2.local,
proj3.local,proj4.local,proj5.local
Which will translate into:
nginx:
container_name: nginx
environment:
VIRTUAL_HOST: "proj1.local,proj2.local, proj3.local,proj4.local,proj5.local"
image: nginx