testcontainers / testcontainers-python

Testcontainers is a Python library that providing a friendly API to run Docker container. It is designed to create runtime environment to use during your automatic tests.

Home Page:https://testcontainers-python.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature: read OCI images from the disk without requiring a tarball

alexeagle opened this issue · comments

What are you trying to do?

Under Bazel, or other local-only build systems, an image is constructed as a series of layers which are only on the disk, not pushed to any remote docker registry.

To test such an image, one option is to create a tarball format that's suitable for docker load. Then in the Setup of the python test, you can use the docker library from Pypi to do that docker load.
However, constructing the tarball is an expensive operation. In particular as Bazel has distinct build steps that can run remotely and have cached results, we get a massive file for a typical user image that has to be stored on a network location. Building the tarball should not be required, it's just a way to be docker load-compatible.

Instead, we could teach testcontainers how to read the OCI format, which is a JSON descriptor pointing to the layers as blobs. These could be loaded into the daemon directly.

aspect-build/bazel-examples#306 shows how this looks.

i happen to agree that low level tar manipulations to make docker images are the bees knees but i kind of came back to this a couple of times and im not convinced there is a compelling story that makes someone want to look for this functionality from this library in particular (testcontainers). can you share what your use case is? or are you trying to build a JIB for python and use testcontainers as a building block?