Limit resources in docker-compose v3
mem_limit is no longer supported in version 3 of docker-compose.yml file. The documentation tells that I should use the deploy.resources key instead but also that this part will only be effective with swarm or docker stack. cpu_shares, cpu_quota, cpuset, mem_limit, memswap_limit: These have been replaced by the resources key under deploy. Note that deploy configuration only takes effect when using docker stack deploy, and is ignored by docker-compose. ... as written in the docs. How do I set memory/cpu limits with docker-compose with v3 format of the yml file?
I was wondering the same thing and found this: https://github.com/docker/compose/issues/4513 So in short it's just not possible to do that, you have to use the version 2.1 of the docker-compose format to be able to specify limits that are not ignored by docker-compose up
I was searching the same too... I think the links are little but you can land here: https://docs.docker.com/compose/compose-file/#resources resources: limits: cpus: '0.001' memory: 50M reservations: cpus: '0.0001' memory: 20M and https://docs.docker.com/engine/reference/run/#runtime-constraints-on-resources for more details on constraints
Passing arguments to docker compose file when using it for swarm
How to run ad hoc docker compose commands in Ansible?
Using custom hostnames for docker local development containers
Changing the network name?
Let external container know about subnets created by multiple docker-compose projects
How to monitor / discover more docker containers with prometheus
two docker-compose .yml in the same network with COMPOSE_PROJECT_NAME
docker compose 3.1(swarm), secrets, ssl and nginx
What is the version directive for?
How to run docker-compose up -d at system start up?
In Docker Compose can I have services exiting
Docker compose - secrets Additional property secrets is not allowed
docker-compose mounted volume remain
Should I do anything after upgrading docker-compose?
docker caddy proxy not forwarding
docker share OS volume between services