Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add memory-swap and memory-swappiness support to v3 since it was available in v2 #7594

Closed
jamshid opened this issue Jul 8, 2020 · 9 comments

Comments

@jamshid
Copy link

jamshid commented Jul 8, 2020

Is your feature request related to a problem? Please describe.

You can configure memswap_limit and mem_swappiness in v2 compose files.
Docs (https://docs.docker.com/compose/compose-file/#resources) claim v3 replaces these settings with deploy: resources:.
These docs are very misleading, these swap settings simply cannot be configured in v3 format.

Describe the solution you'd like
First, please make the current situation clear in the docs. These docs cause so much unnecessary confusion like:
https://forums.docker.com/t/memory-swap-vs-memory-swappiness-and-using-in-docker-compose/54889
https://stackoverflow.com/questions/44325949/how-to-replace-memswap-limit-in-docker-compose-3

If the answer as @shin- seemed to indicate is to keep using v2, then make it clear that v3 format is not needed and should not be used if you (very reasonably) want to configure swap settings for your services.

But really I'd like docker-compose to make the v3 format a complete replacement of v2, anything you could configure in v2 (or with docker run) should be available in v3. Also --compatibility should be default behavior.

Describe alternatives you've considered
Switch back to v2 format? I'm not using docker swarm so I guess I could try but I'd like to deploy to k8s eventually.

Additional context
The problem I'm running into is that some services are using a lot of swap. I know I should probably disable swap on the host server but not always possible/easy.
This is mostly the same issue as #4513 but hopefully you will reconsider now that you're taking a fresh look at compose.

@stale
Copy link

stale bot commented Apr 17, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 17, 2022
@stale
Copy link

stale bot commented Apr 25, 2022

This issue has been automatically closed because it had not recent activity during the stale period.

@stale stale bot closed this as completed Apr 25, 2022
@arteeh
Copy link

arteeh commented Apr 6, 2023

I will never understand people adding the stale bot. Just because there's no replies, doesn't mean the problem has magically gone away.

@crowley666x
Copy link

This is important. Do it!

@glours
Copy link
Contributor

glours commented Jul 24, 2023

@crowley666x
Since Compose v2, you don't need to use the version anymore as the Compose Specification merged the 2 file formats (v2.x and v3.x). So you should be now able to define memory resource usages on the deploy section and the memory swapiness directly on the service.

@maxiwheat
Copy link

@crowley666x Since Compose v2, you don't need to use the version anymore as the Compose Specification merged the 2 file formats (v2.x and v3.x). So you should be now able to define memory resource usages on the deploy section and the memory swapiness directly on the service.

I guess you are referering to this part in the doc : https://docs.docker.com/compose/compose-file/05-services/#mem_swappiness

I find it a little odd that the other resources options are under the deploy section, and that this one remains at the service level. Also, for memswap_limit, the doc says :

This is a modifier attribute that only has meaning if memory is also set

And it is not clear where this memory option comes from, maybe it should added that it's in the deploy section

I also think that a note could be added in here to specify that swap options are not at the deploy level, but at the service level

@TheExDeus
Copy link

So memswap_limit isn't deprecated as the docs say because v2 and v3 was merged?
Would still be good if it was configurable in deploy section for consistency though.

@Aposhian
Copy link

Just noting that this is still confusing and underdocumented.

@Mart-Bogdan
Copy link

It doestn't work.

If I specify it under service level:

Compose file contains unsupported options:

memswap_limit: Set resource limits using deploy.resources

And if I put it there:

services.my_srv.deploy.resources.limits Additional property memswap is not allowed

memswap_limit is not allowed as well.

also : services.my_srv.deploy.resources Additional property memswap_limit is not allowed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants