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

[Bug]: ReusableResourceTest leaks docker resources #1157

Closed
0xced opened this issue Apr 20, 2024 · 0 comments · Fixed by #1164
Closed

[Bug]: ReusableResourceTest leaks docker resources #1157

0xced opened this issue Apr 20, 2024 · 0 comments · Fixed by #1164
Labels
bug Something isn't working

Comments

@0xced
Copy link
Contributor

0xced commented Apr 20, 2024

Testcontainers version

3.8.0

Using the latest Testcontainers version?

Yes

Host OS

Any

Host arch

Any

.NET version

8.0.204

Docker version

Not relevant

Docker info

Not relevant

What happened?

Running the ShouldReuseExistingResource test in the ReusableResourceTest creates a reusable container, a reusable network and a reusable volume. They are properly disposed in the DisposeAsync method but since these three resources are configured as reusable they are not deleted.

This is not an issue when running on disposable virtual machines for continuous integration scenarios. This is problematic when running on our development machines where those resources with random GUIDs are piling up, though. The accumulation of networks is particularly problematic since it will eventually lead to this error: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network, rendering Docker unusable until running docker network prune manually.

Both DockerNetwork and DockerVolume have a public DeleteAsync method but those classes are internal. The DockerContainer class is public but has no DeleteAsync method so I'm not sure what's the best way to fix this issue.

Besides the issue about the test I had already wondered how a reusable Docker resource could be deleted programatically using the Testcontainers API.

Relevant log output

No response

Additional information

No response

@0xced 0xced added the bug Something isn't working label Apr 20, 2024
0xced added a commit to 0xced/testcontainers-dotnet that referenced this issue Apr 26, 2024
0xced added a commit to 0xced/testcontainers-dotnet that referenced this issue Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant