gpt4 book ai didi

docker - 兼容模式不支持以下部署子键

转载 作者:行者123 更新时间:2023-12-02 18:05:55 25 4
gpt4 key购买 nike

我必须为服务使用 500MB 的内存限制和设置为 0.6 的 CPU,我还需要在 docker-compose 文件中使用版本 3。

我尝试:$ docker-compose docker_compose.yml --compatibility up
我得到:
WARNING: The following deploy sub-keys are not supported in compatibility mode and have been ignored: resources.reservations.cpus

version: '3.3'

services:
web:
image: myimage:1.2.3
volumes:
- 'delle:/home/rh'
deploy:
resources:
limits:
memory: 500M
reservations:
cpus: '0.6'
networks:
- mynetwork
- internal

networks:
mynetwork:
external: true
internal:
volumes:
delle:

有人可以帮忙吗?只有群吗?

最佳答案

不妨将 v2 用于 docker-compose file .

version: "2.4"

services:
web:
image: myimage:1.2.3
volumes:
- 'delle:/home/rh'
cpu_count: 1
cpus: 0.6
cpu_percent: 30
mem_limit: 500m
networks:
- mynetwork
- internal

networks:
mynetwork:
external: true
internal:
volumes:
delle

对于 v3,这解释了为什么它不支持 resources.reservations.cpusresources.limits.cpus作为内存。见 thread

Docker Compose doesn't work with swarm mode (it deploys local containers), so there's no orchestrator to take those limits into account


正如@Kalpesh 指出的(在我的评论下方),尝试删除 资源,预留cpu .
您可以通过以下方式检查它:
# run compatibility
docker-compose --compatibility up -d

docker inspect --format '{{json .HostConfig.Memory}}' <CONTAINER_NAME> | numfmt --to=iec

docker inspect --format '{{json .HostConfig.NanoCpus}}' <CONTAINER_NAME> | numfmt --to=iec

关于docker - 兼容模式不支持以下部署子键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58308238/

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