Running the following command will validate our docker-compose.yml file:
$ docker-compose config
If there are no issues, it will print a rendered copy of your Docker Compose YAML file to screen; this is how Docker Compose will interpret your file. If you don't want to see this output and just want to check for errors, then you can run:
$ docker-compose config -q
This is shorthand for --quiet. If there are any errors, which the examples we have worked through so far shouldn't have, they will be displayed as follows:
ERROR: yaml.parser.ParserError: while parsing a block mapping
in "./docker-compose.yml", line 1, column 1
expected <block end>, but found '<block mapping start>'
in "./docker-compose.yml", line 27, column 3