[][src]Struct docker_client::container::config::ConfigBuilder

pub struct ConfigBuilder { /* fields omitted */ }

A Config builder.

This type can be used to construct an instance Config through a builder-like pattern.

Examples

Construct a Config example.

use docker_client::container::ConfigBuilder;

fn main() {
    let builder = ConfigBuilder::with_image("alpine")
        .name("example")
        .hostname("localhost")
        .expose_port("80/tcp")
        .build();

    println!("{:?}", builder);
}

Methods

impl ConfigBuilder[src]

pub fn new() -> Self[src]

Creates a new default instance of ConfigBuilder to construct a Config.

pub fn with_image<T>(image: T) -> Self where
    T: Into<String>, 
[src]

Creates a new ConfigBuilder initialized with image.

This method returns an instance of ConfigBuilder which can be used to create a Config.

Examples

Create a new CreationBuilder with image.

let builder = ConfigBuilder::with_image("example-image").build();

pub fn name<T>(&mut self, name: T) -> &mut Self where
    T: Into<String>, 
[src]

Set name for this container.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .name("example-name")
    .build();

pub fn hostname<T>(&mut self, name: T) -> &mut Self where
    T: Into<String>, 
[src]

Set hostname for this container.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .hostname("example-hostname")
    .build();

pub fn domain_name<T>(&mut self, name: T) -> &mut Self where
    T: Into<String>, 
[src]

Set domain name for this container.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .domain_name("example-domainname")
    .build();

pub fn user<T>(&mut self, name: T) -> &mut Self where
    T: Into<String>, 
[src]

Set user for this container.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .user("example-user")
    .build();

pub fn attach_stdin(&mut self, b: bool) -> &mut Self[src]

Set boolean flag attach_stdin for this container.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .attach_stdin(true)
    .build();

pub fn attach_stdout(&mut self, b: bool) -> &mut Self[src]

Set boolean flag attach_stdout for this container.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .attach_stdout(true)
    .build();

pub fn attach_stderr(&mut self, b: bool) -> &mut Self[src]

Set boolean flag attach_stderr for this container.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .attach_stderr(true)
    .build();

pub fn expose_port<T>(&mut self, port: T) -> &mut Self where
    T: Into<String>, 
[src]

Expose port of container to this Config builder.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .expose_port("22/tcp")
    .build();

pub fn tty(&mut self, b: bool) -> &mut Self[src]

Set boolean flag tty for this container.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .tty(true)
    .build();

pub fn open_stdin(&mut self, b: bool) -> &mut Self[src]

Set boolean flag open_stdin for this container.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .open_stdin(true)
    .build();

pub fn stdin_once(&mut self, b: bool) -> &mut Self[src]

Set boolean flag stdin_once for this container.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .stdin_once(true)
    .build();

pub fn env<T>(&mut self, env: T) -> &mut Self where
    T: Into<String>, 
[src]

Append environment variable for this container.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .env("VAR=example-value")
    .build();

pub fn cmd<T>(&mut self, cmd: T) -> &mut Self where
    T: Into<String>, 
[src]

Append command for this container.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .cmd("example-cmd")
    .build();

pub fn health_check(&mut self, health_check: Option<HealthCheck>) -> &mut Self[src]

Set HealthCheck for this container.

pub fn args_escaped(&mut self, b: bool) -> &mut Self[src]

Set args escaped for this container.

Note

Only for Windows.

pub fn image<T>(&mut self, image: T) -> &mut Self where
    T: Into<String>, 
[src]

Set image for this container.

Examples

let builder = ConfigBuilder::new()
    .image("alpine")
    .build();

pub fn volume<T>(&mut self, volume: T) -> &mut Self where
    T: Into<String>, 
[src]

Append volume for this container.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .volume("/path/to/volume")
    .build();

pub fn work_dir<T>(&mut self, work_dir: T) -> &mut Self where
    T: Into<String>, 
[src]

Set work directory for this container.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .work_dir("/path/to/work_dir")
    .build();

pub fn entry_point<T>(&mut self, entry_point: T) -> &mut Self where
    T: Into<String>, 
[src]

Append entry point script.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .entry_point("example-entry-point")
    .build();

pub fn network_disabled(&mut self, b: bool) -> &mut Self[src]

Set flag network_disabled for this container.

Note

  • If b is false then network will enable.
  • If b is true then network will disable.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .network_disabled(true)
    .build();

pub fn mac_address<T>(&mut self, mac_address: T) -> &mut Self where
    T: Into<String>, 
[src]

Set MAC address for this container.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .mac_address("1A:2B:3C:4D:5E:6F")
    .build();

pub fn on_build<T>(&mut self, cmd: T) -> &mut Self where
    T: Into<String>, 
[src]

Append on build script.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .on_build("command-on-build")
    .build();

pub fn label<T, U>(&mut self, k: T, v: U) -> &mut Self where
    T: Into<String>,
    U: Into<String>, 
[src]

Append label of container.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .label("example-label-key", "example-label-value")
    .build();

pub fn stop_signal<T>(&mut self, stop_signal: T) -> &mut Self where
    T: Into<String>, 
[src]

Set stop signal.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .stop_signal("command")
    .build();

pub fn stop_timeout(&mut self, time: Option<i32>) -> &mut Self[src]

Set stop timeout.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .stop_timeout(None)
    .stop_timeout(Some(100))
    .build();

pub fn shell<T>(&mut self, cmd: T) -> &mut Self where
    T: Into<String>, 
[src]

Append shell command.

Examples

let builder = ConfigBuilder::with_image("alpine")
    .shell("shell-command")
    .shell("shell-command-1")
    .build();

pub fn build(&self) -> Config[src]

Build Config from ConfigBuilder

Examples

let builder = ConfigBuilder::with_image("alpine").build();

Trait Implementations

impl Default for ConfigBuilder[src]

impl Debug for ConfigBuilder[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> From<T> for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> 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> Borrow<T> for T where
    T: ?Sized
[src]

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

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