Mapping values are not allowed in this context

cat docker-compose.yml

   -  8080:80
owatem@penguin:~/DockerComposeFile$ docker compose config
parsing /home/owatem/DockerComposeFile/docker-compose.yml: yaml: line 4: mapping values are not allowed in this context

The title of the topic is “I don’t know what I’m doing wrong”,

So the first is choosing a title. Please, choose a title which actually describes the issue. I changed the title. Then please, format your post properly with code blocks so we (and you as well) can see the indentation and not the altered code by the forum. The problem is the indentation which is really important in case of a yaml file. The space after yaml keys are also missing. You can see that becuse I fixed your post and the syntax higligthing shows those lines as red.

Then the database service is not even indented. So I have to say that everything is wrong.

I also moved the topic from the Docker Desktop category since the issue is not related to Docker Desktop.

thanks a lot i just still a DevOps dummy

So what the solution. I was just following what i saw on a youtube class i was learning from.

Have you tried to fix it based on my comments? Since this is just about a correct YAML syntax, I believe it is really easy to fix after the hints I gave you, so I didn’t want to just give you the corrected yaml.

Note that, indentation is the most important and key-value pairs have to be separated by at least a space. Except of course the port mapping, because that is not part of the yaml syntax, but a string which just use the same separator character so it would in fact invalid to put a space after the colon.

watching is never enough. You also need to read about what yourubers show you.

1 Like