Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

extends keyword in docker-compose deprecated?

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?

like image 277
membersound Avatar asked Oct 24 '25 16:10

membersound


2 Answers

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.

like image 111
David Maze Avatar answered Oct 26 '25 12:10

David Maze


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/

like image 45
excitoon Avatar answered Oct 26 '25 12:10

excitoon