According to the docs https://docs.docker.com/compose/compose-file/compose-versioning/#version-3, the extends keyword has been removed in docker compose v3.
Anyways, the docs also clearly show the usage of the extends keyword in the most recent docs: https://docs.docker.com/compose/multiple-compose-files/extends/
So, can extends be used as is will be supported in future? Or should it be avoided as it is officially deprecated?
There is a fourth major version of the Compose file format, the Compose specification. This was re-released in combination with a rebuild of the Compose tool itself.
Historically, Compose file version 2 had options more oriented towards single-system deployments, and version 3 had options more oriented towards Docker Swarm deployments. The "specification" format generally supports both sets of options, and ignores the version: specifier.
For extends: in particular, the specification definition of it doesn't mention it as deprecated, and as you note it has a dedicated page in the standalone Compose documentation. I'd consider it safe to use.
They removed it in 3 but restored in 4: "Legacy versions 2.x and 3.x of the Compose file format were merged into the Compose Specification."
https://docs.docker.com/compose/compose-file/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With