Struct docker_api::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(self, working_dir: impl Serialize) -> Self
pub fn working_dir(self, working_dir: impl Serialize) -> Self
Specify the working dir (corresponds to the -w
docker cli argument)
sourcepub fn security_options<S>(
self,
security_options: impl IntoIterator<Item = S>
) -> Self where
S: Serialize,
pub fn security_options<S>(
self,
security_options: impl IntoIterator<Item = S>
) -> Self where
S: Serialize,
Specify a Vec of string values to customize labels for MLS systems, such as SELinux.
sourcepub fn volumes<S>(self, volumes: impl IntoIterator<Item = S>) -> Self where
S: Serialize,
pub fn volumes<S>(self, volumes: impl IntoIterator<Item = S>) -> Self where
S: Serialize,
Specify any bind mounts, taking the form of /some/host/path:/some/container/path
pub fn links<S>(self, links: impl IntoIterator<Item = S>) -> Self where
S: 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<K, V>(self, labels: impl IntoIterator<Item = (K, V)>) -> Self where
K: Serialize + Eq + Hash,
V: 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<S>(self, extra_hosts: impl IntoIterator<Item = S>) -> Self where
S: Serialize,
pub fn volumes_from<S>(self, volumes_from: impl IntoIterator<Item = S>) -> Self where
S: Serialize,
pub fn network_mode(self, network_mode: impl Serialize) -> Self
pub fn env<S>(self, env: impl IntoIterator<Item = S>) -> Self where
S: Serialize,
pub fn cmd<S>(self, cmd: impl IntoIterator<Item = S>) -> Self where
S: Serialize,
pub fn entrypoint<S>(self, entrypoint: impl IntoIterator<Item = S>) -> Self where
S: Serialize,
pub fn capabilities<S>(self, capabilities: impl IntoIterator<Item = S>) -> Self where
S: Serialize,
pub fn devices(self, devices: Vec<Labels>) -> Self
pub fn log_driver(self, log_driver: impl Serialize) -> Self
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(self, stop_signal: impl Serialize) -> Self
pub fn stop_signal(self, stop_signal: impl Serialize) -> Self
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(self, userns_mode: impl Serialize) -> Self
pub fn privileged(self, privileged: bool) -> Self
pub fn user(self, user: impl Serialize) -> Self
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