[][src]Struct bollard::DockerChain

pub struct DockerChain { /* fields omitted */ }

DockerChain

Retains the same API as the Docker Client, but consumes the instance and returns the instance as part of the response.

Examples

use bollard::Docker;
let docker = Docker::connect_with_http_defaults().unwrap();
docker.chain();

Methods

impl DockerChain[src]

pub fn kill_container<T, K, V>(
    self,
    container_name: &str,
    options: Option<T>
) -> impl Future<Item = (DockerChain, ()), Error = Error> where
    T: KillContainerQueryParams<K, V>,
    K: AsRef<str>,
    V: AsRef<str>, 
[src]


Kill Container

Kill a container. Consumes the client instance.

Arguments

Returns

  • A Tuple containing the original DockerChain instance, and the unit type (), wrapped in a Future.

Examples


use bollard::container::KillContainerOptions;

let options = Some(KillContainerOptions{
    signal: "SIGINT",
});

docker.chain().kill_container("postgres", options);

pub fn remove_container<T, K, V>(
    self,
    container_name: &str,
    options: Option<T>
) -> impl Future<Item = (DockerChain, ()), Error = Error> where
    T: RemoveContainerQueryParams<K, V>,
    K: AsRef<str>,
    V: AsRef<str>, 
[src]


Remove Container

Remove a container. Consumes the instance.

Arguments

Returns

  • A Tuple containing the original DockerChain instance, and the unit type (), wrapped in a Future.

Examples


use bollard::container::RemoveContainerOptions;

use std::default::Default;

let options = Some(RemoveContainerOptions{
    force: true,
    ..Default::default()
});

docker.chain().remove_container("hello-world", options);

pub fn create_container<T, K, V, Z>(
    self,
    options: Option<T>,
    config: Config<Z>
) -> impl Future<Item = (DockerChain, CreateContainerResults), Error = Error> where
    T: CreateContainerQueryParams<K, V>,
    K: AsRef<str>,
    V: AsRef<str>,
    Z: AsRef<str> + Eq + Hash + Serialize
[src]


Create Container

Prepares a container for a subsequent start operation. Consumes the instance.

Arguments

Returns

Examples

use bollard::container::{CreateContainerOptions, Config};

use std::default::Default;

let options = Some(CreateContainerOptions{
    name: "my-new-container",
});

let config = Config {
    image: Some("hello-world"),
    cmd: Some(vec!["/hello"]),
    ..Default::default()
};

docker.chain().create_container(options, config);

pub fn start_container<T, K, V>(
    self,
    container_name: &str,
    options: Option<T>
) -> impl Future<Item = (DockerChain, ()), Error = Error> where
    T: StartContainerQueryParams<K, V>,
    K: AsRef<str>,
    V: AsRef<str>, 
[src]


Start Container

Starts a container, after preparing it with the Create Container API. Consumes the client instance.

Arguments

Returns

  • A Tuple containing the original DockerChain instance, and the unit type (), wrapped in a Future.

Examples

use bollard::container::StartContainerOptions;

docker.chain().start_container("hello-world", None::<StartContainerOptions<String>>);

pub fn stop_container<T, K>(
    self,
    container_name: &str,
    options: Option<T>
) -> impl Future<Item = (DockerChain, ()), Error = Error> where
    T: StopContainerQueryParams<K>,
    K: AsRef<str>, 
[src]


Stop Container

Stops a container. Consumes the client instance.

Arguments

Returns

  • A Tuple containing the original DockerChain instance, and the unit type (), wrapped in a Future.

Examples

use bollard::container::StopContainerOptions;

let options = Some(StopContainerOptions{
    t: 30,
});

docker.chain().stop_container("hello-world", options);

pub fn list_containers<T, K>(
    self,
    options: Option<T>
) -> impl Future<Item = (DockerChain, Vec<APIContainers>), Error = Error> where
    T: ListContainersQueryParams<K, String>,
    K: AsRef<str>, 
[src]


List Containers

Returns a list of containers. Consumes the client instance.

Arguments

Returns

Examples

use bollard::container::ListContainersOptions;

use std::collections::HashMap;
use std::default::Default;

let mut filters = HashMap::new();
filters.insert("health", vec!("unhealthy"));

let options = Some(ListContainersOptions{
    all: true,
    filters: filters,
    ..Default::default()
});

docker.chain().list_containers(options);

pub fn wait_container<T, K, V>(
    self,
    container_name: &str,
    options: Option<T>
) -> impl Future<Item = (DockerChain, impl Stream<Item = WaitContainerResults, Error = Error>), Error = Error> where
    T: WaitContainerQueryParams<K, V>,
    K: AsRef<str>,
    V: AsRef<str>, 
[src]


Wait Container

Wait for a container to stop. This is a non-blocking operation, the resulting stream will end when the container stops. Consumes the instance.

Arguments

Returns

Examples


use bollard::container::WaitContainerOptions;

let options = Some(WaitContainerOptions{
    condition: "not-running",
});

docker.chain().wait_container("hello-world", options);

pub fn inspect_container<T, K, V>(
    self,
    container_name: &str,
    options: Option<T>
) -> impl Future<Item = (DockerChain, Container), Error = Error> where
    T: InspectContainerQueryParams<K, V>,
    K: AsRef<str>,
    V: AsRef<str>, 
[src]


Inspect Container

Inspect a container. Consumes the instance.

Arguments

Returns

Examples

use bollard::container::InspectContainerOptions;

let options = Some(InspectContainerOptions{
    size: false,
});

docker.chain().inspect_container("hello-world", options);

pub fn restart_container<T, K>(
    self,
    container_name: &str,
    options: Option<T>
) -> impl Future<Item = (DockerChain, ()), Error = Error> where
    T: RestartContainerQueryParams<K>,
    K: AsRef<str>, 
[src]


Restart Container

Restart a container. Consumes the client instance.

Arguments

Returns

  • A Tuple containing the original DockerChain instance, and the unit type (), wrapped in a Future.

Examples


use bollard::container::RestartContainerOptions;

let options = Some(RestartContainerOptions{
    t: 30,
});

docker.chain().restart_container("postgres", options);

pub fn top_processes<T, K, V>(
    self,
    container_name: &str,
    options: Option<T>
) -> impl Future<Item = (DockerChain, TopResult), Error = Error> where
    T: TopQueryParams<K, V>,
    K: AsRef<str>,
    V: AsRef<str>, 
[src]


Top Processes

List processes running inside a container. Consumes the client instance.

Arguments

  • Container name as string slice.
  • Optional Top Options struct.

Returns

Examples

use bollard::container::TopOptions;

let options = Some(TopOptions{
    ps_args: "aux",
});

docker.chain().top_processes("fnichol/uhttpd", options);

pub fn logs<T, K>(
    self,
    container_name: &str,
    options: Option<T>
) -> impl Future<Item = (DockerChain, impl Stream<Item = LogOutput, Error = Error>), Error = Error> where
    T: LogsQueryParams<K>,
    K: AsRef<str>, 
[src]


Logs

Get container logs. Consumes the client instance.

Arguments

Returns

Examples


use bollard::container::LogsOptions;

use std::default::Default;

let options = Some(LogsOptions{
    stdout: true,
    ..Default::default()
});

docker.chain().logs("hello-world", options);

pub fn container_changes(
    self,
    container_name: &str
) -> impl Future<Item = (DockerChain, Option<Vec<Change>>), Error = Error>
[src]


Container Changes

Get changes on a container's filesystem. Consumes the client instance.

Arguments

  • Container name as string slice.

Returns

  • A Tuple containing the original DockerChain instance, and an Option of Vector of Change structs, wrapped in a Future.

Examples


docker.chain().container_changes("hello-world");

pub fn stats<T, K, V>(
    self,
    container_name: &str,
    options: Option<T>
) -> impl Future<Item = (DockerChain, impl Stream<Item = Stats, Error = Error>), Error = Error> where
    T: StatsQueryParams<K, V>,
    K: AsRef<str>,
    V: AsRef<str>, 
[src]


Stats

Get container stats based on resource usage. Consumes the client instance.

Arguments

Returns

  • A Tuple containing the original DockerChain instance, and a Stats struct, wrapped in a Stream.

Examples


use bollard::container::StatsOptions;

let options = Some(StatsOptions{
    stream: false,
});

docker.chain().stats("hello-world", options);

pub fn update_container(
    self,
    container_name: &str,
    config: UpdateContainerOptions
) -> impl Future<Item = (DockerChain, ()), Error = Error>
[src]


Update Container

Update a container. Consumes the client instance.

Arguments

Returns

  • A Tuple containing the original DockerChain instance, and the unit type (), wrapped in a Future.

Examples


use bollard::container::UpdateContainerOptions;
use std::default::Default;

let config = UpdateContainerOptions {
    memory: Some(314572800),
    memory_swap: Some(314572800),
    ..Default::default()
};

docker.chain().update_container("postgres", config);

pub fn rename_container<T, K, V>(
    self,
    container_name: &str,
    options: T
) -> impl Future<Item = (DockerChain, ()), Error = Error> where
    T: RenameContainerQueryParams<K, V>,
    K: AsRef<str>,
    V: AsRef<str>, 
[src]


Rename Container

Rename a container. Consumes the client instance.

Arguments

Returns

  • A Tuple containing the original DockerChain instance, and the unit type (), wrapped in a Future.

Examples


use bollard::container::RenameContainerOptions;

let required = RenameContainerOptions {
    name: "my_new_container_name"
};

docker.chain().rename_container("hello-world", required);

pub fn pause_container(
    self,
    container_name: &str
) -> impl Future<Item = (DockerChain, ()), Error = Error>
[src]


Pause Container

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

Arguments

  • Container name as a string slice.

Returns

  • A Tuple containing the original DockerChain instance, and the unit type (), wrapped in a Future.

Examples


docker.chain().pause_container("postgres");

pub fn unpause_container(
    self,
    container_name: &str
) -> impl Future<Item = (DockerChain, ()), Error = Error>
[src]


Unpause Container

Resume a container which has been paused. Consumes the client instance.

Returns

  • A Tuple containing the original DockerChain instance, and the unit type (), wrapped in a Future.

Examples


docker.chain().unpause_container("postgres");

pub fn prune_containers<T, K>(
    self,
    options: Option<T>
) -> impl Future<Item = (DockerChain, PruneContainersResults), Error = Error> where
    T: PruneContainersQueryParams<K>,
    K: AsRef<str> + Eq + Hash
[src]


Prune Containers

Delete stopped containers. Consumes the client instance.

Arguments

Returns

Examples


use bollard::container::PruneContainersOptions;

use std::collections::HashMap;

let mut filters = HashMap::new();
filters.insert("until", vec!("10m"));

let options = Some(PruneContainersOptions {
  filters: filters
});

docker.chain().prune_containers(options);

pub fn upload_to_container<T, K, V>(
    self,
    container_name: &str,
    options: Option<T>,
    tar: Body
) -> impl Future<Item = (DockerChain, ()), Error = Error> where
    T: UploadToContainerQueryParams<K, V>,
    K: AsRef<str>,
    V: AsRef<str>, 
[src]


Upload To Container

Upload a tar archive to be extracted to a path in the filesystem of container id. Consumes the client instance.

Arguments

Returns

  • A Tuple containing the original DockerChain instance, and the unit type (), wrapped in a Future.

Examples

use bollard::container::UploadToContainerOptions;

use std::default::Default;
use std::fs::File;
use std::io::Read;

let options = Some(UploadToContainerOptions{
    path: "/opt",
    ..Default::default()
});

let mut file = File::open("tarball.tar.gz").unwrap();
let mut contents = Vec::new();
file.read_to_end(&mut contents).unwrap();

docker.chain().upload_to_container("my-container", options, contents.into());

pub fn download_from_container<T, K, V>(
    self,
    container_name: &str,
    options: Option<T>
) -> impl Future<Item = (DockerChain, impl Stream<Item = Chunk, Error = Error>), Error = Error> where
    T: DownloadFromContainerQueryParams<K, V>,
    K: AsRef<str>,
    V: AsRef<str>, 
[src]


Download From Container

Get a tar archive of a resource in the filesystem of container id. Consumes the client instance.

Arguments

Returns

  • A Tuple containing the original DockerChain instance, and a tar archive compressed with one of the following algorithms: identity (no compression), gzip, bzip2, xz, represented as a Hyper Body, wrapped in a Future.

Examples

use bollard::container::DownloadFromContainerOptions;

let options = Some(DownloadFromContainerOptions{
    path: "/opt",
});

docker.chain().download_from_container("my-container", options);

impl DockerChain[src]

pub fn create_exec<T>(
    self,
    container_name: &str,
    config: CreateExecOptions<T>
) -> impl Future<Item = (DockerChain, CreateExecResults), Error = Error> where
    T: AsRef<str> + Serialize
[src]


Create Exec

Run a command inside a running container. Consumes the client instance.

Arguments

Returns

Examples


use bollard::exec::CreateExecOptions;

use std::default::Default;

let config = CreateExecOptions {
    cmd: Some(vec!["ps", "-ef"]),
    attach_stdout: Some(true),
    ..Default::default()
};

docker.chain().create_exec("hello-world", config);

pub fn start_exec(
    self,
    container_name: &str,
    config: Option<StartExecOptions>
) -> impl Future<Item = (DockerChain, impl Stream<Item = StartExecResults, Error = Error>), Error = Error>
[src]


Start Exec

Starts a previously set up exec instance. If detach is true, this endpoint returns immediately after starting the command. Consumes the client instance.

Arguments

  • Container name as string slice.

Returns

Examples


use bollard::exec::StartExecOptions;

docker.chain().start_exec("hello-world", None::<StartExecOptions>);

pub fn inspect_exec(
    self,
    container_name: &str
) -> impl Future<Item = (DockerChain, ExecInspect), Error = Error>
[src]


Inspect Exec

Return low-level information about an exec instance. Consumes the client instance.

Arguments

  • Container name as string slice.

Returns

Examples


docker.chain().inspect_exec("hello-world");

impl DockerChain[src]

pub fn create_image<T, K, V>(
    self,
    options: Option<T>,
    credentials: Option<DockerCredentials>
) -> impl Future<Item = (DockerChain, impl Stream<Item = CreateImageResults, Error = Error>), Error = Error> where
    T: CreateImageQueryParams<K, V>,
    K: AsRef<str>,
    V: AsRef<str>, 
[src]


Create Image

Create an image by either pulling it from a registry or importing it. Consumes the client instance.

Arguments

Returns

Examples

use bollard::image::CreateImageOptions;

use std::default::Default;

let options = Some(CreateImageOptions{
  from_image: "hello-world",
  ..Default::default()
});

docker.chain().create_image(options, None);

// do some other work while the image is pulled from the docker hub...

Unsupported

  • Import from tarball

pub fn tag_image<T, K, V>(
    self,
    image_name: &str,
    options: Option<T>
) -> impl Future<Item = (DockerChain, ()), Error = Error> where
    T: TagImageQueryParams<K, V>,
    K: AsRef<str>,
    V: AsRef<str>, 
[src]


Tag Image

Tag an image so that it becomes part of a repository. Consumes the instance.

Arguments

Returns

  • A Tuple containing the original DockerChain instance, and the unit type (), wrapped in a Future.

Examples


use bollard::image::TagImageOptions;

let tag_options = Some(TagImageOptions {
    tag: "v1.0.1",
    ..Default::default()
});

docker.chain().tag_image("hello-world", tag_options);

pub fn push_image<T, K, V>(
    self,
    image_name: &str,
    options: Option<T>,
    credentials: Option<DockerCredentials>
) -> impl Future<Item = (DockerChain, ()), Error = Error> where
    T: PushImageQueryParams<K, V>,
    K: AsRef<str>,
    V: AsRef<str>, 
[src]


Push Image

Push an image to a registry. Consumes the instance.

Arguments

Returns

  • A Tuple containing the original DockerChain instance, and the unit type (), wrapped in a Future.

Examples


use bollard::auth::DockerCredentials;
use bollard::image::PushImageOptions;

use std::default::Default;

let push_options = Some(PushImageOptions {
    tag: "v1.0.1",
});

let credentials = Some(DockerCredentials {
    username: Some("Jack".to_string()),
    password: Some("myverysecretpassword".to_string()),
    ..Default::default()
});

docker.push_image("hello-world", push_options, credentials);

pub fn remove_image<T, K, V>(
    self,
    image_name: &str,
    options: Option<T>,
    credentials: Option<DockerCredentials>
) -> impl Future<Item = (DockerChain, Vec<RemoveImageResults>), Error = Error> where
    T: RemoveImageQueryParams<K, V>,
    K: AsRef<str>,
    V: AsRef<str>, 
[src]


Remove Image

Remove an image, along with any untagged parent images that were referenced by that image. Consumes the client instance.

Arguments

Returns

Examples


use bollard::image::RemoveImageOptions;

let remove_options = Some(RemoveImageOptions {
    force: true,
    ..Default::default()
});

docker.chain().remove_image("hello-world", remove_options, None);

pub fn search_images<T, K>(
    self,
    options: T
) -> impl Future<Item = (DockerChain, Vec<APIImageSearch>), Error = Error> where
    T: SearchImagesQueryParams<K>,
    K: AsRef<str>, 
[src]


Search Images

Search for an image on Docker Hub. Consumes the client instance.

Arguments

Returns

Examples


use bollard::image::SearchImagesOptions;
use std::default::Default;
use std::collections::HashMap;

let mut filters = HashMap::new();
filters.insert("until", "10m");

let search_options = SearchImagesOptions {
    term: "hello-world",
    filters: filters,
    ..Default::default()
};

docker.chain().search_images(search_options);

pub fn inspect_image(
    self,
    image_name: &str
) -> impl Future<Item = (DockerChain, Image), Error = Error>
[src]


Inspect Image

Return low-level information about an image. Consumes the client instance.

Arguments

  • Image name as a string slice.

Returns

  • A Tuple containing the original DockerChain instance, and an Image, wrapped in a Future.

Examples


use std::default::Default;

docker.chain().inspect_image("hello-world");

pub fn list_images<T, K>(
    self,
    options: Option<T>
) -> impl Future<Item = (DockerChain, Vec<APIImages>), Error = Error> where
    T: ListImagesQueryParams<K>,
    K: AsRef<str>, 
[src]


List Images

Returns a list of images on the server. Note that it uses a different, smaller representation of an image than inspecting a single image. Consumes the client instance.

Arguments

Returns

  • A Tuple containing the original DockerChain instance, and a Vector of APIImages, wrapped in a Future.

Examples

use bollard::image::ListImagesOptions;

use std::collections::HashMap;
use std::default::Default;

let mut filters = HashMap::new();
filters.insert("dangling", vec!["true"]);

let options = Some(ListImagesOptions{
  all: true,
  filters: filters,
  ..Default::default()
});

docker.chain().list_images(options);

pub fn image_history(
    self,
    image_name: &str
) -> impl Future<Item = (DockerChain, Vec<ImageHistory>), Error = Error>
[src]


Image History

Return parent layers of an image. Consumes the client instance.

Arguments

  • Image name as a string slice.

Returns

Examples


docker.chain().image_history("hello-world");

pub fn prune_images<T, K>(
    self,
    options: Option<T>
) -> impl Future<Item = (DockerChain, PruneImagesResults), Error = Error> where
    T: PruneImagesQueryParams<K>,
    K: AsRef<str>, 
[src]


Prune Images

Delete unused images. Consumes the client instance.

Arguments

Returns

Examples

use bollard::image::PruneImagesOptions;

use std::collections::HashMap;

let mut filters = HashMap::new();
filters.insert("until", vec!["10m"]);

let options = Some(PruneImagesOptions {
  filters: filters
});

docker.chain().prune_images(options);

pub fn commit_container<T, K, V, Z>(
    self,
    options: T,
    config: Config<Z>
) -> impl Future<Item = (DockerChain, CommitContainerResults), Error = Error> where
    T: CommitContainerQueryParams<K, V>,
    K: AsRef<str>,
    V: AsRef<str>,
    Z: AsRef<str> + Eq + Hash + Serialize
[src]


Commit Container

Create a new image from a container.

Arguments

Returns

Examples

use bollard::image::CommitContainerOptions;
use bollard::container::Config;

use std::default::Default;

let options = CommitContainerOptions{
    container: "my-running-container",
    pause: true,
    ..Default::default()
};

let config = Config::<String> {
    ..Default::default()
};

docker.chain().commit_container(options, config);

pub fn build_image<T, K>(
    self,
    options: T,
    credentials: Option<HashMap<String, DockerCredentials>>,
    tar: Option<Body>
) -> impl Future<Item = (DockerChain, impl Stream<Item = BuildImageResults, Error = Error>), Error = Error> where
    T: BuildImageQueryParams<K>,
    K: AsRef<str>, 
[src]


Build Image

Build an image from a tar archive with a Dockerfile in it.

The Dockerfile specifies how the image is built from the tar archive. It is typically in the archive's root, but can be at a different path or have a different name by specifying the dockerfile parameter.

Arguments

Returns

Examples

use bollard::image::BuildImageOptions;
use bollard::container::Config;

use std::default::Default;
use std::fs::File;
use std::io::Read;

let options = BuildImageOptions{
    dockerfile: "Dockerfile",
    t: "my-image",
    rm: true,
    ..Default::default()
};

let mut file = File::open("tarball.tar.gz").unwrap();
let mut contents = Vec::new();
file.read_to_end(&mut contents).unwrap();

docker.build_image(options, None, Some(contents.into()));

impl DockerChain[src]

pub fn version(
    self
) -> impl Future<Item = (DockerChain, Version), Error = Error>
[src]


Version

Returns the version of Docker that is running and various information about the system that Docker is running on. Consumes the client instance.

Returns

  • A Tuple containing the original DockerChain instance, and a Version, wrapped in a Future.

Examples

docker.chain().version();

pub fn ping(self) -> impl Future<Item = (DockerChain, String), Error = Error>[src]


Ping

This is a dummy endpoint you can use to test if the server is accessible. Consumes the client instance.

Returns

  • A Tuple containing the original DockerChain instance, and a String, wrapped in a Future.

Examples


docker.chain().ping();

Trait Implementations

impl Clone for DockerChain[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for DockerChain[src]

Auto Trait Implementations

impl Send for DockerChain

impl Sync for DockerChain

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T