Struct ContainerOptionsBuilder

Source
pub struct ContainerOptionsBuilder { /* private fields */ }

Implementations§

Source§

impl ContainerOptionsBuilder

Source

pub fn name(&mut self, name: &str) -> &mut Self

Source

pub fn working_dir(&mut self, working_dir: &str) -> &mut Self

Specify the working dir (corresponds to the -w docker cli argument)

Source

pub fn volumes(&mut self, volumes: Vec<&str>) -> &mut Self

Specify any bind mounts, taking the form of /some/host/path:/some/container/path

Source

pub fn publish_all_ports(&mut self) -> &mut Self

enable all exposed ports on the container to be mapped to random, available, ports on the host

Source

pub fn expose( &mut self, srcport: u32, protocol: &str, hostport: u32, ) -> &mut Self

Source

pub fn publish(&mut self, srcport: u32, protocol: &str) -> &mut Self

Publish a port in the container without assigning a port on the host

Source

pub fn memory(&mut self, memory: u64) -> &mut Self

Source

pub fn memory_swap(&mut self, memory_swap: i64) -> &mut Self

Total memory limit (memory + swap) in bytes. Set to -1 (default) to enable unlimited swap.

Source

pub fn nano_cpus(&mut self, nano_cpus: u64) -> &mut Self

CPU quota in units of 10-9 CPUs. Set to 0 (default) for there to be no limit.

For example, setting nano_cpus to 500_000_000 results in the container being allocated 50% of a single CPU, while 2_000_000_000 results in the container being allocated 2 CPUs.

Source

pub fn cpus(&mut self, cpus: f64) -> &mut Self

CPU quota in units of CPUs. This is a wrapper around nano_cpus to do the unit conversion.

See nano_cpus.

Source

pub fn cpu_shares(&mut self, cpu_shares: u32) -> &mut Self

Sets an integer value representing the container’s relative CPU weight versus other containers.

Source

pub fn labels(&mut self, labels: &HashMap<&str, &str>) -> &mut Self

Source

pub fn attach_stdin(&mut self, attach: bool) -> &mut Self

Whether to attach to stdin.

Source

pub fn attach_stdout(&mut self, attach: bool) -> &mut Self

Whether to attach to stdout.

Source

pub fn attach_stderr(&mut self, attach: bool) -> &mut Self

Whether to attach to stderr.

Source

pub fn tty(&mut self, tty: bool) -> &mut Self

Whether standard streams should be attached to a TTY.

Source

pub fn extra_hosts(&mut self, hosts: Vec<&str>) -> &mut Self

Source

pub fn volumes_from(&mut self, volumes: Vec<&str>) -> &mut Self

Source

pub fn network_mode(&mut self, network: &str) -> &mut Self

Source

pub fn env<E, S>(&mut self, envs: E) -> &mut Self
where S: AsRef<str> + Serialize, E: AsRef<[S]> + Serialize,

Source

pub fn cmd(&mut self, cmds: Vec<&str>) -> &mut Self

Source

pub fn entrypoint(&mut self, entrypoint: &str) -> &mut Self

Source

pub fn capabilities(&mut self, capabilities: Vec<&str>) -> &mut Self

Source

pub fn devices(&mut self, devices: Vec<HashMap<String, String>>) -> &mut Self

Source

pub fn log_driver(&mut self, log_driver: &str) -> &mut Self

Source

pub fn restart_policy( &mut self, name: &str, maximum_retry_count: u64, ) -> &mut Self

Source

pub fn auto_remove(&mut self, set: bool) -> &mut Self

Source

pub fn stop_signal(&mut self, sig: &str) -> &mut Self

Signal to stop a container as a string. Default is “SIGTERM”.

Source

pub fn stop_signal_num(&mut self, sig: u64) -> &mut Self

Signal to stop a container as an integer. Default is 15 (SIGTERM).

Source

pub fn stop_timeout(&mut self, timeout: Duration) -> &mut Self

Timeout to stop a container. Only seconds are counted. Default is 10s

Source

pub fn userns_mode(&mut self, mode: &str) -> &mut Self

Source

pub fn privileged(&mut self, set: bool) -> &mut Self

Source

pub fn user(&mut self, user: &str) -> &mut Self

Source

pub fn build(&self) -> ContainerOptions

Trait Implementations§

Source§

impl Default for ContainerOptionsBuilder

Source§

fn default() -> ContainerOptionsBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T