How to determine highest docker-compose file version for the installed docker-compose

Viewed 430

I have docker-compose 1.25.4 on a system, and docker 19.03. How do I know which version of Compose file format it supports, without trying a bunch or searching through release notes etc?

I determined by trial and error that the highest Compose file format version that docker-compose 1.25.4 supports is 3.7. Therefore, my docker-compose.yml requires version: "3.7".

But what if I need to determine this programmatically? Or reliably, without trial and error, and without looking at release notes?

The docs at https://docs.docker.com/compose/compose-file/compose-versioning/ suggest that highest version should be 3.8 but this does not work. Indeed the release notes indicate that 3.8 became supported as of docker-compose 1.25.5.

I looked through various docker-compose commands and could not spot anything that would say "This version of docker-compose supports Compose file version up to x.y".

1 Answers

I figured out that there is no way to find this out via the cli. You need to check the docker-compose github releases for this.

For example on Ubuntu: v1.25.0 version of docker-compose which is currently the latest and gets to be installed by default, but it is compatible with the 3.7 at highest. https://github.com/docker/compose/releases/tag/1.25.0

The Compose file format compatibility matrix part is the interesting here.

Related