Docker service disable memory swap

Viewed 5904

can i set “MemorySwap” and “MemorySwappiness” for docker service? I would like to disable memory swap for docker containers (started by docker service) but i don’t want to disable it for host machine. What means value of -1 at “MemorySwappiness”?

Docker version: 17.06.2-ce

1 Answers

Although this question is old, as it has no answer I have decided to post one.

Indeed, disabling memory swap is now supported by just using the option --memory-swap when creating the container. You simply have to set --memory and --memory-swap to the same value, according to the docs.

For more information about memory swapping, visit this page of the docs about constraining resource access.

Related