Question: Can I cache a docker image
What are you trying to do?
I have a docker image which is based on postgres, but contains additional some (large) *.sql files in /docker-entrypoint-initdb.d/ .
When the docker container is started, it will import the sql files. This will delay the startup time until I can access the docker image for testing.
I assume that when I use testcontainers it is similiar to the call
docker run --rm
in the sense, that after the container was used, it is thrown away.
Is it possible to tell testcontainers to cache the container, so the next time I use that image the database is already initialized?
yes, in testcontainers world this is referred to as "reusable" if you search youll see we have had several PRs about this but it is just not done yet
Hi @alexanderankin ,
thanks for the fast response. Do you have a timeline when such a feature is integrated into testcontainers?
no, im fairly busy at work so not sure when i will have time
On Tue, Sep 23, 2025 at 7:11 AM Dieter Bogdoll @.***> wrote:
dbogdoll left a comment (testcontainers/testcontainers-python#878) https://github.com/testcontainers/testcontainers-python/issues/878#issuecomment-3323543545
Hi @alexanderankin https://github.com/alexanderankin ,
thanks for the fast response. Do you have a timeline when such a feature is integrated into testcontainers?
— Reply to this email directly, view it on GitHub https://github.com/testcontainers/testcontainers-python/issues/878#issuecomment-3323543545, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACECGJBGNLOVFOD4YOGIWWD3UETHDAVCNFSM6AAAAACHHZMXD2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGMRTGU2DGNJUGU . You are receiving this because you were mentioned.Message ID: @.***>