You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first two are because I actually build the container twice, for reasons related to the project. test is an example build from docker 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:
# ---- Stage 0 ----
# Builds media repo binaries
FROM golang:1.19-alpine AS builder
# ... commands ...
RUN ./build.sh
# ---- Stage 1 ----
# Final runtime stage.
FROM alpine
COPY --from=builder /opt/bin/media_repo /usr/local/bin/
# ... commands ...
CMD ./run.sh
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:
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.
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: