-
-
Notifications
You must be signed in to change notification settings - Fork 522
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]: Interstitial images from builds are not cleaned up #1484
Comments
Hi @turt2live sorry for the delay, I'm doing a triage of the repo and found this issue as a quick win 🤞 . I submitted a PR yesterday, so I wonder if you could give it a try 🙏 |
Unfortunately I haven't been able to upgrade to newer versions due to something with mounts. I've been meaning to fix it though, so will try to take a look. |
Yeah, we changed it a little bit a few releases ago. Please let me know if I can be of help, here or in Slack, in the migration. Thanks! |
@turt2live we added labels to the built images in #2579, which landed in Thanks! PS: I can still help you out with the migration, if the repo is public I can send a few PRs for it. |
I haven't had much time myself to test, sorry 😭 The repo is up at https://github.com/t2bot/matrix-media-repo if you'd like to poke at it. The test framework stuff is a bit scary looking - if you prefer to leave it alone, that's fine. Equally, if you'd like to rip it all out and try again, please feel free. I have zero attachment to any of that code, and plan to rewrite it one day myself. |
Hey @turt2live I'm not sure if I did it right 😅 but here it is: t2bot/matrix-media-repo#614 🙏 |
Testcontainers version
v0.22.0
Using the latest Testcontainers version?
Yes
Host OS
Windows 11
Host arch
x64
Go version
1.19
Docker version
Client: Cloud integration: v1.0.35-desktop+001 Version: 24.0.5 API version: 1.43 Go version: go1.20.6 Git commit: ced0996 Built: Fri Jul 21 20:36:24 2023 OS/Arch: windows/amd64 Context: default Server: Docker Desktop 4.22.0 (117440) Engine: Version: 24.0.5 API version: 1.43 (minimum version 1.12) Go version: go1.20.6 Git commit: a61e2b4 Built: Fri Jul 21 20:35:45 2023 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.21 GitCommit: 3dce8eb055cbb6872793272b4f20ed16117344f8 runc: Version: 1.1.7 GitCommit: v1.1.7-0-g860f061 docker-init: Version: 0.19.0 GitCommit: de40ad0
Docker info
What happened?
When using a Dockerfile with a multi-stage build, the interstitial images are not cleaned up at the end of execution. I'm building the image with:
Which results in the following dangling images:
The first two are because I actually build the container twice, for reasons related to the project.
test
is an example build fromdocker build -t test .
to see what it does. The remaining two are me trying to trick testcontainers into doing something it isn't really designed to do1, so I'll take responsibility for them ;)Example (partial) dockerfile:
Relevant log output
No response
Additional information
Footnotes
To avoid building an image twice, I dig into the internals of testcontainers-go a bit. Specifically, I create (but don't start) a container directly on the provider then capture the image name for use in a future container start. This seems to leave behind the image (the UUID below
test
in the screenshot above) as well as the interstitial build. ↩The text was updated successfully, but these errors were encountered: