ConTree SDK provides several ways to reference and import container images. For full API documentation, see ImagesManager and ImagesManagerSync.
Using Images by Tag
The simplest way to get an image is images.use(tag). This creates an image object immediately without any API call — the tag is resolved at execution time when you run a command:
Pulling Images
For resolving a tag/UUID to an image upfront, use images.use(strict=True). For importing images from external registries, use images.oci():
Methods
use()(ref) — no API call; tag or UUID is resolved at execution time
use()(ref, strict=True) — verifies the image exists via an API call
oci()(ref) (aliases: docker(), podman(), pull_by_oci()) — like use(strict=True), but imports from the registry if not found locally
import_from()(ref) — always imports from an external registry
use()(ref) — no API call; tag or UUID is resolved at execution time
use()(ref, strict=True) — verifies the image exists via an API call
oci()(ref) (aliases: docker(), podman(), pull_by_oci()) — like use(strict=True), but imports from the registry if not found locally
import_from()(ref) — always imports from an external registry
import_from always triggers a new import operation and should only be used when you explicitly need to re-import. In most cases, prefer images.oci(), which returns an existing image if already imported. If no import is needed at all, use images.use().
What ref can be
- UUID — reference an existing image by its UUID, e.g.
"550e8400-e29b-41d4-a716-446655440000" or UUID(...)
- OCI tag — reference by image tag, e.g.
"ubuntu:latest"
- OCI full URL — full reference including registry host, e.g.
"docker://ghcr.io/owner/image:tag"
OCIReference — programmatic OCI reference object
Tagging Images
You can assign or remove a tag on any image using tag_as() and untag(). Tags are unique across all images — assigning an existing tag to a new image moves it automatically.
You can also tag the result of a run() directly by passing tag= to the call — the resulting image will be tagged after execution completes:
Listing Images
View all available images in your ConTree instance: