testcontainers / testcontainers/testcontainers-python

Question: Can I cache a docker image

Open
#878 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

📖 documentation
Dominant language
Python
Stars
2.3k
Forks
386
Avg merge
4h 40m
Merged PRs (30d)
1

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the Testcontainers container lifecycle and the Docker behavior implied by docker run --rm, especially PostgreSQL initialization from /docker-entrypoint-initdb.d/. Determine whether reuse or caching is supported, then document the supported behavior or the scope needed for a cacheable initialized container.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, postgres, python
Domain
databases, testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.