docker-compose.yaml 定义的 AWS ECS 任务的软内存限制
Soft memory limit for AWS ECS task defined by docker-compose.yaml
亚马逊提供ecs-cli compose
命令可以设置任务定义从docker-compose.yaml
但我无法为此类任务声明内存限制(尤其是软限制)。不支持部署选项。
Skipping unsupported YAML option for service... option name=deploy
有没有办法用 compose 实现这个?或者正在使用 compose 坏主意,最好使用本机任务定义。
更新
我的撰写文件被请求,这是它
version: '3'
services:
worker:
image: 880289074637.dkr.ecr.us-east-1.amazonaws.com/negative-keywords:latest
env_file: .env
command: ["celery", "-A", "negmatch", "worker", "-l", "info"]
deploy:
resources:
limits:
cpus: '0.50'
memory: 256M
reservations:
cpus: '0.25'
memory: 128M
web:
image: 880289074637.dkr.ecr.us-east-1.amazonaws.com/negative-keywords:latest
env_file: .env
ports:
- "80:8000"
depends_on:
- "worker"
deploy:
resources:
limits:
cpus: '0.50'
memory: 256M
reservations:
cpus: '0.25'
memory: 128M
您将需要使用 docker compose 的 v2 来设置值。
截至今天,根据 docker docs,deploy
仅适用于群模式部署。
Looking for options to set resources on non swarm mode containers?
The options described here are specific to the deploy key and swarm
mode. If you want to set resource constraints on non swarm
deployments, use Compose file format version 2 CPU, memory, and other
resource options. If you have further questions, refer to the
discussion on the GitHub issue docker/compose/4513.
有关使用 v2 与 v3 的更多信息。
https://github.com/docker/compose/issues/4513#issuecomment-377311337
这里是示例 docker-compose(v2),它对任务的容器定义设置了软内存和硬内存限制。 mem_limit
是硬限制,mem_reservation
是软限制。
命令 -
ecs-cli compose --project-name nginx --file docker-compose.yaml create
撰写文件 -
version: '2'
services:
nginx:
image: "nginx:latest"
mem_limit: 512m
mem_reservation: 128m
cpu_shares: 0
ports:
- 80
亚马逊提供ecs-cli compose
命令可以设置任务定义从docker-compose.yaml
但我无法为此类任务声明内存限制(尤其是软限制)。不支持部署选项。
Skipping unsupported YAML option for service... option name=deploy
有没有办法用 compose 实现这个?或者正在使用 compose 坏主意,最好使用本机任务定义。
更新 我的撰写文件被请求,这是它
version: '3'
services:
worker:
image: 880289074637.dkr.ecr.us-east-1.amazonaws.com/negative-keywords:latest
env_file: .env
command: ["celery", "-A", "negmatch", "worker", "-l", "info"]
deploy:
resources:
limits:
cpus: '0.50'
memory: 256M
reservations:
cpus: '0.25'
memory: 128M
web:
image: 880289074637.dkr.ecr.us-east-1.amazonaws.com/negative-keywords:latest
env_file: .env
ports:
- "80:8000"
depends_on:
- "worker"
deploy:
resources:
limits:
cpus: '0.50'
memory: 256M
reservations:
cpus: '0.25'
memory: 128M
您将需要使用 docker compose 的 v2 来设置值。
截至今天,根据 docker docs,deploy
仅适用于群模式部署。
Looking for options to set resources on non swarm mode containers?
The options described here are specific to the deploy key and swarm mode. If you want to set resource constraints on non swarm deployments, use Compose file format version 2 CPU, memory, and other resource options. If you have further questions, refer to the discussion on the GitHub issue docker/compose/4513.
有关使用 v2 与 v3 的更多信息。 https://github.com/docker/compose/issues/4513#issuecomment-377311337
这里是示例 docker-compose(v2),它对任务的容器定义设置了软内存和硬内存限制。 mem_limit
是硬限制,mem_reservation
是软限制。
命令 -
ecs-cli compose --project-name nginx --file docker-compose.yaml create
撰写文件 -
version: '2'
services:
nginx:
image: "nginx:latest"
mem_limit: 512m
mem_reservation: 128m
cpu_shares: 0
ports:
- 80