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<P: Into<HostPort>>( self, srcport: PublishPort, hostport: P, ) -> 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)>) -> Self
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 log_driver_config<K, V>( self, log_driver_config: impl IntoIterator<Item = (K, V)>, ) -> 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
Sourcepub fn init(self, init: bool) -> Self
pub fn init(self, init: bool) -> Self
Run an init inside the container that forwards signals and reaps processes. This field is omitted if empty, and the default (as configured on the daemon) is used.
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.
Sourcepub fn ipc(self, ipc: IpcMode) -> Self
pub fn ipc(self, ipc: IpcMode) -> Self
IPC sharing mode for the container. Default is “private” or “shareable”, depending on daemon version.
Sourcepub fn network_config(self, network_config: NetworkingConfig) -> Self
pub fn network_config(self, network_config: NetworkingConfig) -> Self
Represents the container’s networking configuration for each of its interfaces.
Sourcepub fn runtime(self, runtime: impl Serialize) -> Self
pub fn runtime(self, runtime: impl Serialize) -> Self
Runtime to use for this container like “nvidia”
Sourcepub fn device_requests(self, device_requests: Vec<DeviceRequest>) -> Self
pub fn device_requests(self, device_requests: Vec<DeviceRequest>) -> Self
Requested list of available devices with capabilities