Struct docker_api::api::container::opts::ContainerOptsBuilder
source · [−]pub struct ContainerOptsBuilder { /* private fields */ }
Implementations
sourceimpl ContainerOptsBuilder
impl ContainerOptsBuilder
sourcepub fn publish_all_ports(self) -> Self
pub fn publish_all_ports(self) -> Self
enable all exposed ports on the container to be mapped to random, available, ports on the host
pub fn expose(self, srcport: PublishPort, hostport: u32) -> Self
sourcepub fn publish(self, port: PublishPort) -> Self
pub fn publish(self, port: PublishPort) -> Self
Publish a port in the container without assigning a port on the host
sourcepub fn working_dir<W>(self, working_dir: W) -> Self where
W: AsRef<str> + Serialize,
pub fn working_dir<W>(self, working_dir: W) -> Self where
W: AsRef<str> + Serialize,
Specify the working dir (corresponds to the -w
docker cli argument)
sourcepub fn security_options<O, S>(self, security_options: O) -> Self where
O: IntoIterator<Item = S>,
S: AsRef<str> + Serialize,
pub fn security_options<O, S>(self, security_options: O) -> Self where
O: IntoIterator<Item = S>,
S: AsRef<str> + Serialize,
Specify a Vec of string values to customize labels for MLS systems, such as SELinux.
sourcepub fn volumes<V, S>(self, volumes: V) -> Self where
V: IntoIterator<Item = S>,
S: AsRef<str> + Serialize,
pub fn volumes<V, S>(self, volumes: V) -> Self where
V: IntoIterator<Item = S>,
S: AsRef<str> + Serialize,
Specify any bind mounts, taking the form of /some/host/path:/some/container/path
pub fn links<L, S>(self, links: L) -> Self where
L: IntoIterator<Item = S>,
S: AsRef<str> + Serialize,
pub fn memory(self, memory: u64) -> Self
sourcepub fn memory_swap(self, memory_swap: i64) -> Self
pub fn memory_swap(self, memory_swap: i64) -> Self
Total memory limit (memory + swap) in bytes. Set to -1 (default) to enable unlimited swap.
sourcepub fn nano_cpus(self, nano_cpus: u64) -> Self
pub fn nano_cpus(self, nano_cpus: u64) -> 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.
sourcepub fn cpus(self, cpus: f64) -> Self
pub fn cpus(self, cpus: f64) -> Self
CPU quota in units of CPUs. This is a wrapper around nano_cpus
to do the unit conversion.
See nano_cpus
.
Sets an integer value representing the container’s relative CPU weight versus other containers.
pub fn labels<L, K, V>(self, labels: L) -> Self where
L: IntoIterator<Item = (K, V)>,
K: AsRef<str> + Serialize + Eq + Hash,
V: AsRef<str> + Serialize,
sourcepub fn attach_stdin(self, attach: bool) -> Self
pub fn attach_stdin(self, attach: bool) -> Self
Whether to attach to stdin
.
sourcepub fn attach_stdout(self, attach_stdout: bool) -> Self
pub fn attach_stdout(self, attach_stdout: bool) -> Self
Whether to attach to stdout
.
sourcepub fn attach_stderr(self, attach_stderr: bool) -> Self
pub fn attach_stderr(self, attach_stderr: bool) -> Self
Whether to attach to stderr
.
pub fn extra_hosts<H, S>(self, extra_hosts: H) -> Self where
H: IntoIterator<Item = S>,
S: AsRef<str> + Serialize,
pub fn volumes_from<V, S>(self, volumes_from: V) -> Self where
V: IntoIterator<Item = S>,
S: AsRef<str> + Serialize,
pub fn network_mode<M>(self, network_mode: M) -> Self where
M: AsRef<str> + Serialize,
pub fn env<E, S>(self, env: E) -> Self where
E: IntoIterator<Item = S>,
S: AsRef<str> + Serialize,
pub fn cmd<C, S>(self, cmd: C) -> Self where
C: IntoIterator<Item = S>,
S: AsRef<str> + Serialize,
pub fn entrypoint<E, S>(self, entrypoint: E) -> Self where
E: IntoIterator<Item = S>,
S: AsRef<str> + Serialize,
pub fn capabilities<C, S>(self, capabilities: C) -> Self where
C: IntoIterator<Item = S>,
S: AsRef<str> + Serialize,
pub fn devices(self, devices: Vec<Labels>) -> Self
pub fn log_driver<L>(self, log_driver: L) -> Self where
L: AsRef<str> + Serialize,
pub fn restart_policy(self, name: &str, maximum_retry_count: u64) -> Self
pub fn auto_remove(self, auto_remove: bool) -> Self
sourcepub fn stop_signal<S>(self, stop_signal: S) -> Self where
S: AsRef<str> + Serialize,
pub fn stop_signal<S>(self, stop_signal: S) -> Self where
S: AsRef<str> + Serialize,
Signal to stop a container as a string. Default is "SIGTERM"
sourcepub fn stop_signal_num(self, stop_signal_num: u64) -> Self
pub fn stop_signal_num(self, stop_signal_num: u64) -> Self
Signal to stop a container as an integer. Default is 15 (SIGTERM).
sourcepub fn stop_timeout(self, stop_timeout: Duration) -> Self
pub fn stop_timeout(self, stop_timeout: Duration) -> Self
Timeout to stop a container. Only seconds are counted. Default is 10s
pub fn userns_mode<M>(self, userns_mode: M) -> Self where
M: AsRef<str> + Serialize,
pub fn privileged(self, privileged: bool) -> Self
pub fn user<U>(self, user: U) -> Self where
U: AsRef<str> + Serialize,
pub fn build(&self) -> ContainerCreateOpts
Trait Implementations
sourceimpl Default for ContainerOptsBuilder
impl Default for ContainerOptsBuilder
sourcefn default() -> ContainerOptsBuilder
fn default() -> ContainerOptsBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for ContainerOptsBuilder
impl Send for ContainerOptsBuilder
impl Sync for ContainerOptsBuilder
impl Unpin for ContainerOptsBuilder
impl UnwindSafe for ContainerOptsBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more