我应该在 docker-compose 文件中使用次要版本吗?

Should I use minor version in my docker-compose file?

有时,我只能在 docker-compose.yml 文件中看到主要版本,例如 version: '3'。 其他时候也能看到像version: '3.7'

这样的小版本

我没有找到任何最佳实践。

是只指定主要版本更灵活,还是将格式固定为次要版本更严格?

始终指定次要版本,否则使用 <major>.0

来自docker compose documentation

v2 and v3 Declaration

Note: When specifying the Compose file version to use, make sure to specify both the major and minor numbers. If no minor version is given, 0 is used by default and not the latest minor version.