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 an option to specify memory limit to TestcontainersBuilder #508

Closed
michal-korniak opened this issue Jul 7, 2022 · 2 comments
Closed
Labels
question Have you tried our Slack workspace (https://testcontainers.slack.com)?

Comments

@michal-korniak
Copy link

michal-korniak commented Jul 7, 2022

Hi.
I noticed that some of my tests fails with OutOfMemoryException. We use windows containers (HyperV) and it seems that by default memory is limited to 1GB. I didn't find any information about changing this default value, so it seems that only possibility to change this limit is to use --memory flag during starting the container (https://docs.docker.com/engine/reference/run/#runtime-constraints-on-resources). We don't have this option now, but I think that it will be very useful. For now it could be impossible to test some memory demanding windows containers.

https://stackoverflow.com/questions/43460770/docker-windows-container-memory-limit
https://stackoverflow.com/questions/58803693/physical-memory-limits-inside-windows-container-with-process-isolation

@HofmeisterAn
Copy link
Collaborator

HofmeisterAn commented Jul 7, 2022

You can override the configuration with WithCreateContainerParametersModifier added in #503:

.WithCreateContainerParametersModifier(parameterModifier => parameterModifier.HostConfig.Memory = 2048)

@HofmeisterAn HofmeisterAn added the question Have you tried our Slack workspace (https://testcontainers.slack.com)? label Jul 7, 2022
@michal-korniak
Copy link
Author

Great feature, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Have you tried our Slack workspace (https://testcontainers.slack.com)?
Projects
None yet
Development

No branches or pull requests

2 participants