Docker Community Forums

Share and learn in the Docker community.

Deploy: resources: limits should be ignored but it s actually not

Hello,

The doc says that if i want to set ressources constraints with docker compose v3 i have to either run in swarm mode or use the --compatibility flag.

"
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.
"


I didnt use any of them and unexpectedly my setting have been taken into account !

docker-compose:
     
version: "3.4"
services:
  dockera:
(...)
    deploy:
      resources:
        limits:
          memory: 2000M

# docker container stats
CONTAINER ID NAME  CPU%      MEM USAGE/LIMIT   MEM%  NET I/O  BLOCK I/O   PIDS       9255128f7d74 docker-a 0.12%  26.98MiB /1.953GiB   1.35%1.29kB/0B  0B/0B    5

-> memory limit is there !

Any clue how i can explain this behaviour ?

thanks.