Support omitting compose file version
As of docker-compose v1.27.0, the compose file version is now optional, defaulting to the Compose Specification, rather than v1.0. Here's the exact working from the specification:
Version top-level element Top-level version property is defined by the specification for backward compatibility but is only informative.
and another mention that it's now optional in their docs:
A docker-compose.yml looks like this:
version: "3.9" # optional since v1.27.0
...
To support this change to the specification I've made the following changes to the plugin:
- Allow
versionto be omitted from the compose file. When omitted,versionis also omitted from the generated override compose file. - Specifically check for version 1.* when verifying support for
cache_from
Our main use case for this change is to improve how we manage our docker-compose files for use in integration tests. We typically layer multiple docker-compose files from different repos in the same docker-compose project to integration test a combination of services. When compose file versions are specified they must all be identical which makes it difficult to upgrade compose file versions and adds an unnecessary dependency across repos. Being able to omit them (and only specify a specific version when necessary) will make this easier for us to manage.
I ran into this same issue, this would be really nice to have!