Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Pratyay360/podman-ts/llms.txt
Use this file to discover all available pages before exploring further.
ContainersManager is the primary interface for working with Podman containers. It is accessible via client.containers on any PodmanClient instance and provides methods for the full container lifecycle — from creation through removal — as well as access to Container instances with their own per-container operations.
ContainersManager methods
list
Include stopped containers. Equivalent to
podman ps -a.Maximum number of containers to return.
Key/value filters applied server-side (e.g.
{ status: "running", label: "app=web" }).Return containers created after this container ID/name.
Return containers created before this container ID/name.
get
NotFound if the container does not exist.
Use the Docker-compatible endpoint (
/compat) instead of libpod.create
Container instance. The container is not started — call container.start() after creation. Throws ImageNotFound if the image is not present locally.
Key fields in ContainerCreateOptions:
Image reference (e.g.
"docker.io/library/nginx:latest").Container name.
Override the image’s default command.
Environment variables as a dict or
["KEY=value"] list.Port mappings as
{ "80/tcp": 8080 }. The key is containerPort/protocol; the value is the host port.Bind mounts as
{ "/host/path": { bind: "/container/path", mode: "ro" } }.Container labels.
Run in privileged mode.
Automatically remove the container when it exits.
Restart policy, e.g.
{ Name: "on-failure", MaximumRetryCount: 3 }.Working directory inside the container.
User to run the container as.
ContainerCreateOptions in src/domain/containers_create.ts for the full list of accepted fields.
run
podman run.
- If the image is not found locally, it is pulled automatically (
policy: "missing"). - On exit code
0, returns the captured stdout as a string. - On non-zero exit, throws
ContainerErrorwith the exit code. - With
detach: true, starts the container and returns theContainerinstance immediately.
RunOptions extends ContainerCreateOptions (minus image) with:
Capture stdout in the returned log string.
Capture stderr in the returned log string.
Remove the container after it exits.
Return the
Container immediately without waiting.Platform override when pulling the image (e.g.
"linux/amd64").Auth credentials forwarded to the pull call.
exists
true if a container with the given ID or name exists, false otherwise.
remove
Stop and remove a running container.
Also remove anonymous volumes attached to the container.
prune
{ until: "24h" }). Returns a summary of removed containers and reclaimed space.
Container instance methods
AContainer object is returned by create(), run() (when detached), get(), and list(). It exposes these methods:
Lifecycle
| Method | Signature | Description |
|---|---|---|
start | (): Promise<void> | Start the container. |
stop | (options?: { timeout?: number }): Promise<void> | Stop the container, with optional grace period in seconds. |
restart | (options?: { timeout?: number }): Promise<void> | Restart the container. |
kill | (signal?: string | number): Promise<void> | Send a signal to the container (default SIGKILL). |
pause | (): Promise<void> | Pause all processes in the container. |
unpause | (): Promise<void> | Unpause a paused container. |
wait | (options?: { condition?: string | string[]; interval?: string }): Promise<number> | Block until the container reaches condition. Returns the exit code. |
remove | (options?: { force?: boolean; volumes?: boolean; depend?: boolean }): Promise<void> | Remove the container. |
Inspection and metadata
| Method | Signature | Description |
|---|---|---|
inspect | (options?: { size?: boolean }): Promise<Record<string, unknown>> | Return the full JSON inspect object from the Podman API. |
rename | (newName: string): Promise<void> | Rename the container. |
reload | (): Promise<void> | Refresh container.attrs from the API. |
top | (options?: { psArgs?: string }): Promise<Record<string, unknown>> | List running processes inside the container. |
diff | (options?: { parent?: string; diffType?: "all" | "container" | "image" }): Promise<Array<Record<string, unknown>>> | Show filesystem changes relative to the image. |
Logs
stream: true is set, the return type changes to AsyncIterable<string> for line-by-line streaming.
Include stdout.
Include stderr.
Keep the stream open and follow new output (requires
stream: true).Only return logs since this timestamp or relative duration.
Only return logs up to this timestamp.
Number of lines from the end of the log to return.