If those 9 lines are identical you can probably simplify quite a bit with extension fields and yaml anchors. [0]
You would put
logging: *default-logging
As a single line under each container, and then define it elsewhere. The example on the docs page is for logging, but you can also simplify other fields too, like “depends on”.[0] https://docs.docker.com/compose/compose-file/compose-file-v3...