limit
Using docker run:
docker run -m 512m --memory-reservation=256m nginx
Using docker compose file:
deploy:
resources:
limits:
cpus: 0.50 # WARN: this should be float!
memory: 512M
reservations:
cpus: 0.25 # WARN: this should be float!
memory: 128M
watch
docker stats