Since your yaml file doesn’t include the “version” directive, compose will assume you mean to use version 1 commands. This is intended largely for legacy engines and relatively basic engine features from around engine 1.9. Please see the following link for more details: https://docs.docker.com/compose/compose-file/compose-versioning/#version-1
I also notice that your ports listing are not quoted. That can sometimes cause problems with the parser. For some examples of ports directives, please see https://docs.docker.com/compose/compose-file/#ports
I ran your YAML using a recent engine, quoted the port definitions, and pre-pended a line with version: ‘3’, and was able to run
docker-compose config command, as well as
docker-compose up and
You don’t mention which version of
docker-compose you are using, nor which engine; those may also have an effect on the errors you may see.