I reformatted your post. Next time please mark the whole compose file content and apply “Preformatted Text” once, instead of doing it with each and every line.
I am not able to reproduce the error message with the shared compose file. Is it possible you didn’t share the exact same compose file that actually causes the error message? Furthermore, you might want to make sure you use docker compose (v2), instead of docker-compose (v1, deprecated!)
here is the code, formatted as it is supposed to be in the file and I am still getting the error in my OP. Even after using “docker compose” instead of “docker-compose”
Though, in this particular case it might be easy to spot.
The colon after version is missing. It must be version: '3.3' (regardless of the specific version used). It worked for me, because docker compose v2 ignores the version.
After checking again: it was already included in your original post. THAT is the reason it worked for me when I tried it. Though v2 still ignores the version.