File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ version : " 3.9"
2+
3+ services :
4+ limited_alpine :
5+ image : alpine:latest
6+ container_name : alpine_limited
7+ command : ["sh", "-c", "while true; do sleep 1; done"] # Mantém o container ativo
8+ # Limites de CPU
9+ deploy :
10+ resources :
11+ limits :
12+ cpus : " 1.5" # até 1.5 CPUs
13+ memory : 512M # até 512 MB RAM
14+ reservations :
15+ cpus : " 0.5" # reserva mínima de 0.5 CPUs
16+ memory : 256M # reserva mínima de 256 MB
17+
18+ # Limites adicionais (usando cgroups diretamente)
19+ memswap_limit : 1g # RAM + swap
20+ cpu_shares : 512 # prioridade de CPU (padrão 1024)
21+
22+ # https://docs.docker.com/reference/compose-file/services/#blkio_config
23+ # Limites de disco (blkio)
24+ blkio_config :
25+ weight : 300 # prioridade de I/O (padrão 500, máx 1000)
26+ device_read_bps :
27+ - path : /dev/sda
28+ rate : " 20mb"
29+ device_write_bps :
30+ - path : /dev/sda
31+ rate : " 10mb"
You can’t perform that action at this time.
0 commit comments