gpt4 book ai didi

docker - 如何在docker compose 3中替换memswap_limit?

转载 作者:行者123 更新时间:2023-12-02 17:57:09 34 4
gpt4 key购买 nike

我的 docker-compose 文件(版本 2)中有 memswap_limit,我想在版本 3 上更改我的 docker-compose 文件。
但我没有找到如何替换 memswap_limit。

我看到了诸如“配置资源约束。这替换了版本 3 之前的 Compose 文件中的旧资源约束选项(cpu_shares、cpu_quota、cpuset、mem_limit、memswap_limit)”之类的建议。

我的 docker-compose.yml 文件(版本 2)
db:
image: postgres:alpine
mem_limit: 512m
memswap_limit: 512m

最佳答案

同意@BlackVegetable。更新到 V3 后 memswap_limit 不再存在,人们向 docker github 提交了票证,希望它能够将其恢复。我只是做了一点调查,它仍然不受支持。

现在可能要知道会有交换内存并检查 docker 容器,它会显示内存和交换内存

从 Docker 网站:

If --memory-swap is unset, and --memory is set, the container can use twice as much swap as the --memory setting, if the host container has swap memory configured. For instance, if --memory="300m" and --memory-swap is not set, the container can use 300m of memory and 600m of swap.



或者您可以执行 docker run 命令而不是 docker compose。

关于docker - 如何在docker compose 3中替换memswap_limit?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44325949/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com