Struct docker_api::opts::ContainerCreateOptsBuilder
source · pub struct ContainerCreateOptsBuilder { /* private fields */ }
Implementations§
source§impl ContainerCreateOptsBuilder
impl ContainerCreateOptsBuilder
pub fn new(name: impl Into<String>) -> Self
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 image(self, image: impl Serialize) -> Self
pub fn image(self, image: impl Serialize) -> Self
The name (or reference) of the image to use when creating the container
sourcepub fn security_options<S>(
self,
security_options: impl IntoIterator<Item = S>
) -> Selfwhere
S: Serialize,
pub fn security_options<S>( self, security_options: impl IntoIterator<Item = S> ) -> Selfwhere 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>) -> Selfwhere
S: Serialize,
pub fn volumes<S>(self, volumes: impl IntoIterator<Item = S>) -> Selfwhere 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>) -> Selfwhere 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)>) -> Selfwhere 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>) -> Selfwhere S: Serialize,
pub fn volumes_from<S>(self, volumes_from: impl IntoIterator<Item = S>) -> Selfwhere S: Serialize,
pub fn network_mode(self, network_mode: impl Serialize) -> Self
pub fn env<S>(self, env: impl IntoIterator<Item = S>) -> Selfwhere S: Serialize,
pub fn command<S>(self, command: impl IntoIterator<Item = S>) -> Selfwhere S: Serialize,
pub fn entrypoint<S>(self, entrypoint: impl IntoIterator<Item = S>) -> Selfwhere S: Serialize,
pub fn capabilities<S>(self, capabilities: impl IntoIterator<Item = S>) -> Selfwhere 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
sourcepub fn hostname(self, hostname: impl Serialize) -> Self
pub fn hostname(self, hostname: impl Serialize) -> Self
The hostname to use for the container, as a valid RFC 1123 hostname.
sourcepub fn domainname(self, domainname: impl Serialize) -> Self
pub fn domainname(self, domainname: impl Serialize) -> Self
The domain name to use for the container.