Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to replace memswap_limit in docker compose 3?

I have memswap_limit in my docker-compose file (version 2) and I want to change my docker-compose file on version 3. But I don't found how to replace memswap_limit.

I saw advices like "To configure resource constraints. This replaces the older resource constraint options in Compose files prior to version 3 (cpu_shares, cpu_quota, cpuset, mem_limit, memswap_limit)."

My docker-compose.yml file (version 2)

db: image: postgres:alpine mem_limit: 512m memswap_limit: 512m

like image 792
Анастасия Руденко Avatar asked Jun 02 '17 09:06

Анастасия Руденко


1 Answers

Agree with @BlackVegetable. After updating to V3 memswap_limit is no longer there, people submitted ticket to docker github, hopefully it would bring it back. I just did a little investigation and it is still unsupported.

For now maybe be aware of there would be swap memory and inspect docker container, which would show you the memory and swap memory

From Docker website:

If --memory-swap is unset, and --memory is set, the container can use twice as much swap as the --memory setting, if the host container has swap memory configured. For instance, if --memory="300m" and --memory-swap is not set, the container can use 300m of memory and 600m of swap.

Or you can do the docker run command instead of the docker compose.

like image 147
Daisy QL Avatar answered Sep 22 '22 15:09

Daisy QL