(root) Additional property db is not allowed [ when running docker-compse up]

Dear All,
Need help
When trying to follow the examples in the training video I am getting it to problems, with this message
(root) Additional property db is not allowed
each time I give docker-compose up, I get similar message

(root) Additional property worker is not allowed
(root) Additional property result is not allowed

My docker compose file I am adding it here as attachment for reference
please find the attached file
image
Guidance requested
thanks
Joseph John

The error left after we gave

version: ‘3.3’
services:

in the beginning of the file
Appreciate if you edit the video content to reflect the same
thanks
Joseph John

uploading the working docker-compose.yaml file
extra fields I added was
version : ‘3.3’ [ not given in the video ]
services:

and the PostgreSQL environment

2 Likes

Hello Joseph,
Please, check this lecture Docker Certified Associate Exam Course | KodeKloud

i faced the same problem after following the course and it is solved after following ur steps by adding version and services and environment in db property so I think they should update the video course to avoid misleading for future users

Does anyone know why the v1 config for the docker-compose.yml file is raising this error for us while in the lecture video it was working fine, I even tried mentioning version 1.0 but still the same error
My docker-compose.yml file is as follows

Which lecture are you referring to? A link to the lecture would be very helpful.

Hi Rob,
Lecture: https://www.udemy.com/course/learn-docker/learn/lecture/15829906#overview

I think the reason might be the docker-compose version difference because I have 2.x in my local and the lecture probably has v1.x because I tried running this v1 yml file in labs and it worked fine and when I checked the version it was v1.x in labs. Probably docker-compose v2.x doesn’t support v1 docker-compose syntax. I would appreciate your insights on this.

Looking at the docs, you may be right: v1 is pretty old, and even v3 is really obsolete. You might simply remove the version spec and see if things just work. Per the docs:

Version top-level element (obsolete)

The top-level version property is defined by the Compose Specification for backward compatibility. It is only informative and you’ll receive a warning message that it is obsolete if used.

Compose doesn’t use version to select an exact schema to validate the Compose file, but prefers the most recent schema when it’s implemented.

Compose validates whether it can fully parse the Compose file. If some fields are unknown, typically because the Compose file was written with fields defined by a newer version of the Specification, you’ll receive a warning message.