本文介绍了Docker-compose:如何执行版本2"mem_limit"在版本3中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我尝试将版本 2 docker-compose yaml 文件升级到版本 3 .具体来说,我是从2.1升级到3.4.使用 docker-compose 版本1.18.0和 docker 版本18.06.01.

Recently, I tried upgrading a version 2 docker-compose yaml file to version 3. Specifically, I was going from 2.1 to 3.4. Using docker-compose version 1.18.0 and docker version 18.06.01.

由于版本2选项: mem_limit 的存在,第一次尝试导致 docker-compose 中止.阅读这些版本3文档,它明确指出了 mem_limit 已删除,并看到升级"以指导用法脱离此选项.这些说明告诉您将 deploy 部分与 resources 一起使用.对 docker-compose.yml 文件进行这些更改,系统即可正常启动.

The first attempt caused docker-compose to abort because of the presence of the Version 2 option: mem_limit. Reading these Version 3 docs, it clearly states mem_limit was removed and to see "upgrading" to guide usage away from this option. These instruction tell you to use the deploy section with resources. Making these changes to the docker-compose.yml file and the system started normally.

不幸的是,我错过了该免责声明,该声明指出 docker-compose 会忽略 deploy !我的问题:有没有办法在仍然强制执行容器内存限制的同时使用Compose文件参考3和 docker-compose ?

Unfortunately, I missed the disclaimer in there where it states that deploy is ignored by docker-compose! My question: is there a way to use Compose file reference 3 and docker-compose while still enforcing a container memory limit?

推荐答案

不,没有.

同样,您也不必升级,如果不使用群集,甚至没有任何升级的理由.

And also you don't have to upgrade, you don't even have any reason to upgrade if you don't use swarm.

可悲的是,在正式的docker文档中有声明

Sadly in the official docker docs, there is stated

这实际上不是真的,如果您使用不带集群的docker-compose,几乎没有任何理由在新项目v3上切换或使用.在官方存储库中,您可以看到如下注释: https://github.com/docker/compose/issues/4513#issuecomment-281478365 https://github.com/docker/compose/issues/5586#issuecomment-375577458 .

which isn't actually really true, if you use docker-compose without swarm, there is hardly any reason to switch or to use on new project v3. In the official repository you can see comments like this https://github.com/docker/compose/issues/4513#issuecomment-281478365 or https://github.com/docker/compose/issues/5586#issuecomment-375577458.

还在兼容性矩阵中,您可以看到即使v3退出了相当长的一段时间,v2仍在升级.

Also in the compatibility-matrix you can see that v2 is still upgraded even when v3 is out for quite some time.

这篇关于Docker-compose:如何执行版本2"mem_limit"在版本3中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 22:05