Skip to main content

DockerApi

Trait DockerApi 

Source
pub trait DockerApi: Send + Sync {
Show 22 methods // Required methods fn start( &self, spec: &RunnerSpec, isolation: &dyn Isolation, ) -> impl Future<Output = Result<String, Error>> + Send; fn inspect( &self, container: &str, ) -> impl Future<Output = Result<RunnerState, Error>> + Send; fn remove( &self, container: &str, ) -> impl Future<Output = Result<(), Error>> + Send; fn run( &self, name: &str, body: ContainerCreateBody, ) -> impl Future<Output = Result<String, Error>> + Send; fn list( &self, label: &str, ) -> impl Future<Output = Result<Vec<Container>, Error>> + Send; fn wait( &self, container: &str, ) -> impl Future<Output = Result<i64, Error>> + Send; fn logs( &self, container: &str, ) -> impl Future<Output = Result<String, Error>> + Send; fn logs_since( &self, container: &str, since: u64, ) -> impl Future<Output = Result<String, Error>> + Send; fn exec( &self, container: &str, command: Vec<String>, ) -> impl Future<Output = Result<Output, Error>> + Send; fn image_present( &self, image: &str, ) -> impl Future<Output = Result<bool, Error>> + Send; fn pull( &self, image: &str, ) -> impl Future<Output = Result<(), Error>> + Send; fn ensure_network( &self, name: &str, ) -> impl Future<Output = Result<(), Error>> + Send; fn ensure_volume( &self, name: &str, ) -> impl Future<Output = Result<(), Error>> + Send; fn remove_volume( &self, name: &str, ) -> impl Future<Output = Result<(), Error>> + Send; fn volume_sizes( &self, ) -> impl Future<Output = Result<BTreeMap<String, u64>, Error>> + Send; fn changes( &self, container: &str, ) -> impl Future<Output = Result<Vec<String>, Error>> + Send; fn written( &self, container: &str, ) -> impl Future<Output = Result<u64, Error>> + Send; fn commit( &self, container: &str, reference: &str, labels: BTreeMap<String, String>, ) -> impl Future<Output = Result<u64, Error>> + Send; fn images( &self, label: &str, ) -> impl Future<Output = Result<Vec<Image>, Error>> + Send; fn remove_image( &self, reference: &str, ) -> impl Future<Output = Result<(), Error>> + Send; fn free_space(&self) -> impl Future<Output = Result<u64, Error>> + Send; fn shell( &self, name: &str, body: ContainerCreateBody, size: TtySize, ) -> impl Future<Output = Result<Tty, Error>> + Send;
}
Expand description

The Docker Engine calls the scheduler and the caches make. Docker is the real one; the engine’s tests use a fake.

Required Methods§

Source

fn start( &self, spec: &RunnerSpec, isolation: &dyn Isolation, ) -> impl Future<Output = Result<String, Error>> + Send

Creates and starts a runner container; returns its ID.

Source

fn inspect( &self, container: &str, ) -> impl Future<Output = Result<RunnerState, Error>> + Send

A container’s state and isolation.

Source

fn remove( &self, container: &str, ) -> impl Future<Output = Result<(), Error>> + Send

Removes a runner container, stopping it first if it runs.

Source

fn run( &self, name: &str, body: ContainerCreateBody, ) -> impl Future<Output = Result<String, Error>> + Send

Creates and starts a container that is not a runner, such as the mirror; returns its ID.

Source

fn list( &self, label: &str, ) -> impl Future<Output = Result<Vec<Container>, Error>> + Send

Every container, running or not, that has the label.

Source

fn wait( &self, container: &str, ) -> impl Future<Output = Result<i64, Error>> + Send

Waits for a container to exit; returns its exit code.

Source

fn logs( &self, container: &str, ) -> impl Future<Output = Result<String, Error>> + Send

A container’s output so far, stdout and stderr interleaved.

Source

fn logs_since( &self, container: &str, since: u64, ) -> impl Future<Output = Result<String, Error>> + Send

A container’s output since since (seconds since the epoch), each line prefixed with Docker’s RFC 3339 timestamp and a space.

Source

fn exec( &self, container: &str, command: Vec<String>, ) -> impl Future<Output = Result<Output, Error>> + Send

Runs a command as root in a running container; its stdout streams until it exits or the container stops. Its stderr is dropped.

Source

fn image_present( &self, image: &str, ) -> impl Future<Output = Result<bool, Error>> + Send

Whether Docker has an image.

Source

fn pull(&self, image: &str) -> impl Future<Output = Result<(), Error>> + Send

Pulls an image, logging its progress every few seconds.

Source

fn ensure_network( &self, name: &str, ) -> impl Future<Output = Result<(), Error>> + Send

Creates a bridge network unless it exists.

Source

fn ensure_volume( &self, name: &str, ) -> impl Future<Output = Result<(), Error>> + Send

Creates a volume unless it exists.

Source

fn remove_volume( &self, name: &str, ) -> impl Future<Output = Result<(), Error>> + Send

Removes a volume; a volume that does not exist is not an error.

Source

fn volume_sizes( &self, ) -> impl Future<Output = Result<BTreeMap<String, u64>, Error>> + Send

The disk size of every volume Docker knows, by name. Slow: Docker measures each volume.

Source

fn changes( &self, container: &str, ) -> impl Future<Output = Result<Vec<String>, Error>> + Send

The paths a container’s own layer added or changed, not those it deleted.

Source

fn written( &self, container: &str, ) -> impl Future<Output = Result<u64, Error>> + Send

The bytes a container’s own layer holds.

Source

fn commit( &self, container: &str, reference: &str, labels: BTreeMap<String, String>, ) -> impl Future<Output = Result<u64, Error>> + Send

Commits a stopped container’s own layer as the image reference (repository:tag) with labels; returns the disk the image takes beyond its parent.

Source

fn images( &self, label: &str, ) -> impl Future<Output = Result<Vec<Image>, Error>> + Send

Every image with the label.

Source

fn remove_image( &self, reference: &str, ) -> impl Future<Output = Result<(), Error>> + Send

Removes an image and the layers only it used; one that does not exist is not an error.

Source

fn free_space(&self) -> impl Future<Output = Result<u64, Error>> + Send

The free disk where Docker keeps its images and containers.

Source

fn shell( &self, name: &str, body: ContainerCreateBody, size: TtySize, ) -> impl Future<Output = Result<Tty, Error>> + Send

Creates a container with a terminal of size, attaches to it and starts it. The container’s stdin closes when Tty::input is dropped.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§