Trait Containers

Source
pub trait Containers:
    HasConfig
    + Send
    + Sync {
Show 37 methods // Provided methods fn image_commit_libpod<'a>( &'a self, params: Option<ImageCommitLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_delete_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerDeleteLibpod>, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, Error>> + Send + 'a>> { ... } fn put_container_archive_libpod<'a>( &'a self, name: &'a str, params: Option<PutContainerArchiveLibpod<'a>>, request: String, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_attach_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerAttachLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<TokioIo<Upgraded>, Error>> + Send + 'a>> { ... } fn container_changes_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerChangesLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>> { ... } fn container_checkpoint_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerCheckpointLibpod>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_exists_libpod<'a>( &'a self, name: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_export_libpod<'a>( &'a self, name: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_healthcheck_libpod<'a>( &'a self, name: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_init_libpod<'a>( &'a self, name: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_inspect_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerInspectLibpod>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_kill_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerKillLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_logs_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerLogsLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_mount_libpod<'a>( &'a self, name: &'a str, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>> { ... } fn container_pause_libpod<'a>( &'a self, name: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_rename_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerRenameLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_resize_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerResizeLibpod>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_restart_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerRestartLibpod>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_restore_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerRestoreLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_start_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerStartLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_stats_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerStatsLibpod>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_stop_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerStopLibpod>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_top_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerTopLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_unmount_libpod<'a>( &'a self, name: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_unpause_libpod<'a>( &'a self, name: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_update_libpod<'a>( &'a self, name: &'a str, resources: (), ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_wait_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerWaitLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<i32, Error>> + Send + 'a>> { ... } fn container_create_libpod<'a>( &'a self, create: (), ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn container_list_libpod<'a>( &'a self, params: Option<ContainerListLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, Error>> + Send + 'a>> { ... } fn container_prune_libpod<'a>( &'a self, params: Option<ContainerPruneLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, Error>> + Send + 'a>> { ... } fn container_show_mounted_libpod<'a>( &'a self, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, String>, Error>> + Send + 'a>> { ... } fn containers_stats_all_libpod<'a>( &'a self, params: Option<ContainersStatsAllLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn generate_systemd_libpod<'a>( &'a self, name: &'a str, params: Option<GenerateSystemdLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, String>, Error>> + Send + 'a>> { ... } fn generate_kube_libpod<'a>( &'a self, params: Option<GenerateKubeLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>> { ... } fn kube_apply_libpod<'a>( &'a self, params: Option<KubeApplyLibpod<'a>>, request: String, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>> { ... } fn play_kube_down_libpod<'a>( &'a self, params: Option<PlayKubeDownLibpod>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... } fn play_kube_libpod<'a>( &'a self, params: Option<PlayKubeLibpod<'a>>, request: String, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>> { ... }
}
Available on crate feature v4 only.

Provided Methods§

Source

fn image_commit_libpod<'a>( &'a self, params: Option<ImageCommitLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

POST /libpod/commit

Commit

Create a new image from a container

Source

fn container_delete_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerDeleteLibpod>, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, Error>> + Send + 'a>>

DELETE /libpod/containers/{name}

Delete container

Source

fn put_container_archive_libpod<'a>( &'a self, name: &'a str, params: Option<PutContainerArchiveLibpod<'a>>, request: String, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

GET /libpod/containers/{name}/archive

Copy files into a container

Copy a tar archive of files into a container

Source

fn container_attach_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerAttachLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<TokioIo<Upgraded>, Error>> + Send + 'a>>

POST /libpod/containers/{name}/attach

Attach to a container

Attach to a container to read its output or send it input. You can attach to the same container multiple times and you can reattach to containers that have been detached.

§Hijacking

This endpoint hijacks the HTTP connection to transport stdin, stdout, and stderr on the same socket.

This is the response from the service for an attach request:

HTTP/1.1 200 OK
Content-Type: application/vnd.docker.raw-stream

[STREAM]

After the headers and two new lines, the TCP connection can now be used for raw, bidirectional communication between the client and server.

To inform potential proxies about connection hijacking, the client can also optionally send connection upgrade headers.

For example, the client sends this request to upgrade the connection:

POST /v4.6.0/libpod/containers/16253994b7c4/attach?stream=1&stdout=1 HTTP/1.1
Upgrade: tcp
Connection: Upgrade

The service will respond with a 101 UPGRADED response, and will similarly follow with the raw stream:

HTTP/1.1 101 UPGRADED
Content-Type: application/vnd.docker.raw-stream
Connection: Upgrade
Upgrade: tcp

[STREAM]
§Stream format

When the TTY setting is disabled for the container, the HTTP Content-Type header is set to application/vnd.docker.multiplexed-stream (starting with v4.7.0, previously application/vnd.docker.raw-stream was always used) and the stream over the hijacked connected is multiplexed to separate out stdout and stderr. The stream consists of a series of frames, each containing a header and a payload.

The header contains the information about the output stream type and the size of the payload. It is encoded on the first eight bytes like this:

header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}

STREAM_TYPE can be:

  • 0: stdin (is written on stdout)
  • 1: stdout
  • 2: stderr

SIZE1, SIZE2, SIZE3, SIZE4 are the four bytes of the uint32 size encoded as big endian.

Following the header is the payload, which contains the specified number of bytes as written in the size.

The simplest way to implement this protocol is the following:

  1. Read 8 bytes.
  2. Choose stdout or stderr depending on the first byte.
  3. Extract the frame size from the last four bytes.
  4. Read the extracted size and output it on the correct output.
  5. Goto 1.
§Stream format when using a TTY

When the TTY setting is enabled for the container, the stream is not multiplexed. The data exchanged over the hijacked connection is simply the raw data from the process PTY and client’s stdin.

Source

fn container_changes_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerChangesLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>>

GET /libpod/containers/{name}/changes

Report on changes to container’s filesystem; adds, deletes or modifications.

Returns which files in a container’s filesystem have been added, deleted, or modified. The Kind of modification can be one of:

0: Modified 1: Added 2: Deleted

Source

fn container_checkpoint_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerCheckpointLibpod>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

POST /libpod/containers/{name}/checkpoint

Checkpoint a container

Source

fn container_exists_libpod<'a>( &'a self, name: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

GET /libpod/containers/{name}/exists

Check if container exists

Quick way to determine if a container exists by name or ID

Source

fn container_export_libpod<'a>( &'a self, name: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

GET /libpod/containers/{name}/export

Export a container

Export the contents of a container as a tarball.

Source

fn container_healthcheck_libpod<'a>( &'a self, name: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

GET /libpod/containers/{name}/healthcheck

Run a container’s healthcheck

Execute the defined healthcheck and return information about the results

Source

fn container_init_libpod<'a>( &'a self, name: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

POST /libpod/containers/{name}/init

Initialize a container

Performs all tasks necessary for initializing the container but does not start the container.

Source

fn container_inspect_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerInspectLibpod>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

GET /libpod/containers/{name}/json

Inspect container

Return low-level information about a container.

Source

fn container_kill_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerKillLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

POST /libpod/containers/{name}/kill

Kill container

send a signal to a container, defaults to killing the container

Source

fn container_logs_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerLogsLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

GET /libpod/containers/{name}/logs

Get container logs

Get stdout and stderr logs from a container.

The stream format is the same as described in the attach endpoint.

Source

fn container_mount_libpod<'a>( &'a self, name: &'a str, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>>

POST /libpod/containers/{name}/mount

Mount a container

Mount a container to the filesystem

Source

fn container_pause_libpod<'a>( &'a self, name: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

POST /libpod/containers/{name}/pause

Pause a container

Use the cgroups freezer to suspend all processes in a container.

Source

fn container_rename_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerRenameLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

POST /libpod/containers/{name}/rename

Rename an existing container

Change the name of an existing container.

Source

fn container_resize_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerResizeLibpod>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

POST /libpod/containers/{name}/resize

Resize a container’s TTY

Resize the terminal attached to a container (for use with Attach).

Source

fn container_restart_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerRestartLibpod>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

POST /libpod/containers/{name}/restart

Restart a container

Source

fn container_restore_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerRestoreLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

POST /libpod/containers/{name}/restore

Restore a container

Restore a container from a checkpoint.

Source

fn container_start_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerStartLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

POST /libpod/containers/{name}/start

Start a container

Source

fn container_stats_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerStatsLibpod>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

GET /libpod/containers/{name}/stats

Get stats for a container

DEPRECATED. This endpoint will be removed with the next major release. Please use /libpod/containers/stats instead.

Source

fn container_stop_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerStopLibpod>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

POST /libpod/containers/{name}/stop

Stop a container

Source

fn container_top_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerTopLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

GET /libpod/containers/{name}/top

List processes

List processes running inside a container

Source

fn container_unmount_libpod<'a>( &'a self, name: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

POST /libpod/containers/{name}/unmount

Unmount a container

Unmount a container from the filesystem

Source

fn container_unpause_libpod<'a>( &'a self, name: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

POST /libpod/containers/{name}/unpause

Unpause Container

Source

fn container_update_libpod<'a>( &'a self, name: &'a str, resources: (), ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

POST /libpod/containers/{name}/update

Update an existing containers cgroup configuration

Update an existing containers cgroup configuration.

Source

fn container_wait_libpod<'a>( &'a self, name: &'a str, params: Option<ContainerWaitLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<i32, Error>> + Send + 'a>>

POST /libpod/containers/{name}/wait

Wait on a container

Wait on a container to meet a given condition

Source

fn container_create_libpod<'a>( &'a self, create: (), ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

POST /libpod/containers/create

Create a container

Source

fn container_list_libpod<'a>( &'a self, params: Option<ContainerListLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, Error>> + Send + 'a>>

GET /libpod/containers/json

List containers

Returns a list of containers

Source

fn container_prune_libpod<'a>( &'a self, params: Option<ContainerPruneLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<Vec<()>, Error>> + Send + 'a>>

POST /libpod/containers/prune

Delete stopped containers

Remove containers not in use

Source

fn container_show_mounted_libpod<'a>( &'a self, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, String>, Error>> + Send + 'a>>

GET /libpod/containers/showmounted

Show mounted containers

Lists all mounted containers mount points

Source

fn containers_stats_all_libpod<'a>( &'a self, params: Option<ContainersStatsAllLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

GET /libpod/containers/stats

Get stats for one or more containers

Return a live stream of resource usage statistics of one or more container. If no container is specified, the statistics of all containers are returned.

Source

fn generate_systemd_libpod<'a>( &'a self, name: &'a str, params: Option<GenerateSystemdLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, String>, Error>> + Send + 'a>>

GET /libpod/generate/{name}/systemd

Generate Systemd Units

Generate Systemd Units based on a pod or container.

Source

fn generate_kube_libpod<'a>( &'a self, params: Option<GenerateKubeLibpod<'a>>, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>>

GET /libpod/generate/kube

Generate a Kubernetes YAML file.

Generate Kubernetes YAML based on a pod or container.

Source

fn kube_apply_libpod<'a>( &'a self, params: Option<KubeApplyLibpod<'a>>, request: String, ) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'a>>

POST /libpod/kube/apply

Apply a podman workload or Kubernetes YAML file.

Deploy a podman container, pod, volume, or Kubernetes yaml to a Kubernetes cluster.

Source

fn play_kube_down_libpod<'a>( &'a self, params: Option<PlayKubeDownLibpod>, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

DELETE /libpod/play/kube

Remove resources created from kube play

Tears down pods, secrets, and volumes defined in a YAML file

Source

fn play_kube_libpod<'a>( &'a self, params: Option<PlayKubeLibpod<'a>>, request: String, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'a>>

POST /libpod/play/kube

Play a Kubernetes YAML file.

Create and run pods based on a Kubernetes YAML file (pod or service kind).

Implementors§