podman
Provides utilities and wrappers for creating and manipulating images and containers using the ‘podman’ utility.
Module Contents
- podman.REGISTRY_IMAGE = 'https://github.com/RHSecurityCompliance/contest-data/raw/refs/heads/main/data/docker-registry.tar.gz'
- podman.NETWORK_SUBNET = '192.168.124.0/24'
- class podman.Host
Utilities for host system preparation.
- classmethod setup_network()
- classmethod setup_storage()
- classmethod setup()
- podman.podman(*args, log=True, check=True, **kwargs)
A simple wrapper for the podman(1) CLI, passing python arguments as shell arguments.
- class podman.Containerfile(contents='')
- contents = ''
- add_ssh_pubkey(key, user='root')
- write_to(path)
- class podman.Registry(name='contest-registry', *, host_addr, guest_addr)
Local podman registry as a class (instance).
from lib import virt
- with Registry(host_addr=virt.NETWORK_HOST, guest_addr=virt.NETWORK_GUEST) as reg:
# pull docker.io/foobar, push it to the local registry local_image = reg.push(‘docker.io/foobar’) # push a locally-built image foobar to the local registry local_image = reg.push(‘foobar’) # local_image is ie. ‘127.0.0.1:12345/foobar’ …
- name = 'contest-registry'
- addr
- guest_addr
- registry_image = None
- registry_proc = None
- tagged
- start()
- stop()
- get_listen_addr()
Returns an (address, port) tuple the started-up registry is listening on.
- get_guest_listen_addr()
Return the registry endpoint as seen from a QEMU user-networked guest.
- guest_reference(image)
Translate a host-local pushed image reference for a guest consumer.
- push(image)
Given an image name/url, tag that image with a local registry addr:port and push to the local started-up registry.
Returns image path on the local registry.