podman
podman
¶
Podman helpers shared by the terok packages.
Exposes helpers that spell podman arguments correctly for the host's
podman release: user-namespace mapping for rootless invocations, the
force-pull flag for image builds, and the base of a container's
/etc/hosts.
__all__ = ['podman_hosts_file_args', 'podman_pull_always_args', 'podman_userns_args']
module-attribute
¶
podman_userns_args()
¶
Return user namespace args for rootless podman so UID 1000 maps correctly.
Maps the host user to container UID/GID 1000, the conventional non-root
dev user in terok container images. Returns an empty list when
running as root — root podman runs in the host user namespace and
has no need to remap.
Podman releases older than 4.3 predate the keep-id:uid=…
customization; for those the same mapping is spelled out as explicit
--uidmap/--gidmap triples, assuming the standard 65536-ID
subordinate allotment.
Source code in src/terok_util/podman.py
podman_pull_always_args()
¶
Return the podman build flags that force re-pulling base images.
Podman 4.0 turned --pull into a policy option (--pull=always);
older releases take --pull as a boolean and reject the policy
form outright, spelling the same request --pull-always instead.
Source code in src/terok_util/podman.py
podman_hosts_file_args(base)
¶
Return the podman run flags that set the base of the container's /etc/hosts.
Podman builds that file from a base file. Its default base is the
host's /etc/hosts, which copies private host names into the
container. Podman older than 5.4 has no way to change the base per
container: this returns no flags there, and tells the operator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base
|
str
|
A |
required |