简体   繁体   English

如何查看docker-compose文件版本?

[英]How to check the docker-compose file version?

I would like to make sure that I'm using version 3 of the compose file format. 我想确保我使用的是撰写文件格式的第3版。 However, on https://docs.docker.com/compose/compose-file/ I was not able to find out how to do this. 但是,在https://docs.docker.com/compose/compose-file/上我无法找到如何执行此操作。

My Docker version is 17.04.0-ce, build 4845c56 , and my Docker-Compose version is docker-compose version 1.9.0, build 2585387 . 我的Docker版本是17.04.0-ce, build 4845c56版本为17.04.0-ce, build 4845c56 ,我的Docker-Compose版本是docker-compose version 1.9.0, build 2585387 I'm not sure since when version 3 of the compose file format was introduced, however. 但是,我不确定从何时引入了撰写文件格式的第3版。 How can I find this out? 我怎么能找到这个?

It's on your docker-compose.yml file. 它位于你docker-compose.yml文件中。 First parameter is Docker Compose version. 第一个参数是Docker Compose版本。

version: '3'

Docker Compose version file 3 was introduced in release 1.10.0 of Docker Compose and 1.13.0 release of Docker Engine. Docker Compose版本文件3是在Docker Compose的1.10.0版本和Docker Engine的1.13.0版本中引入的。

Here you can see release notes for Docker Compose 1.10.0 which introduces version file 3: https://github.com/docker/compose/releases/tag/1.10.0 在这里您可以看到Docker Compose 1.10.0的发行说明,其中介绍了版本文件3: https//github.com/docker/compose/releases/tag/1.10.0

The docker compose version 3 syntax requires docker version 1.13 and docker-compose version 1.10 ( see the release notes ). docker compose版本3语法需要docker版本1.13和docker-compose版本1.10( 请参阅发行说明 )。 See the release notes for the version compatibility matrix and upgrade instructions. 有关版本兼容性列表和升级说明,请参阅发行说明。

Note that the version 3 syntax is designed for docker swarm mode, and it was first supported with the docker stack deploy in docker release 1.13. 请注意,版本3语法是为docker swarm模式设计的,它最初是在docker发行版1.13中的docker stack deploy支持的。 There's not much reason to upgrade to the version 3 syntax if you are still using docker-compose itself. 如果您仍在使用docker-compose本身,则没有太多理由升级到版本3语法。

See also the compose file versioning page that describes the differences between the different yml versions. 另请参阅撰写文件版本控制页面,该页面描述了不同yml版本之间的差异。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM