Docker Community Forums

Share and learn in the Docker community.

Memory-swap vs. memory-swappiness and using in docker-compose


(Cyber1000) #1

I have some questions (questions in bold):
1.memory-swap and memory-swappiness


In “PREVENT A CONTAINER FROM USING SWAP” it says:

If --memory and --memory-swap are set to the same value, this prevents containers from using any swap.

But wouldn’t that be the same if I set memory-swappiness to 0?
It was not 100% clear for me from this part of documention.




2. docker-compose v3


In the above link it says:

cpu_shares, cpu_quota, cpuset, mem_limit, memswap_limit: These have been replaced by the resources key under deploy. deploy configuration only takes effect when using docker stack deploy, and is ignored by docker-compose.

Is there any way to use mem_limit, memswap_limit in docker-compose (no docker stack deploy) with file version 3? Or workarounds other ways to set swapping to 0?

Thanks!


(Cyber1000) #2

Sorry again: Has really nobody an idea?


(Cyber1000) #3

Ok found something here, that explains my second question:


Seems that compose file v3 is meant to be used in swarm mode and not with docker-compose and I have to stay in v2 if I want to have these features.

Now only question 1 is missing!