Struct ContainerCreateOptsBuilder

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

Implementations§

Source§

impl ContainerCreateOptsBuilder

Source

pub fn new(name: impl Into<String>) -> Self

Source

pub fn name<N>(self, name: N) -> Self
where N: Into<String>,

Set the name of the container.

Source

pub fn publish_all_ports(self) -> Self

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

Source

pub fn expose<P: Into<HostPort>>( self, srcport: PublishPort, hostport: P, ) -> Self

Source

pub fn publish(self, port: PublishPort) -> Self

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

Source

pub fn working_dir(self, working_dir: impl Serialize) -> Self

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

Source

pub fn image(self, image: impl Serialize) -> Self

The name (or reference) of the image to use when creating the container

Source

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.

Source

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

Source

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

Source

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

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

Source

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.

Source

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.

Source

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

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

Source

pub fn labels<K, V>(self, labels: impl IntoIterator<Item = (K, V)>) -> Self
where K: Serialize + Eq + Hash, V: Serialize,

Source

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

Whether to attach to stdin.

Source

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

Whether to attach to stdout.

Source

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

Whether to attach to stderr.

Source

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

Whether standard streams should be attached to a TTY.

Source

pub fn extra_hosts<S>(self, extra_hosts: impl IntoIterator<Item = S>) -> Self
where S: Serialize,

Source

pub fn volumes_from<S>(self, volumes_from: impl IntoIterator<Item = S>) -> Self
where S: Serialize,

Source

pub fn network_mode(self, network_mode: impl Serialize) -> Self

Source

pub fn env<S>(self, env: impl IntoIterator<Item = S>) -> Self
where S: Serialize,

Source

pub fn command<S>(self, command: impl IntoIterator<Item = S>) -> Self
where S: Serialize,

Source

pub fn entrypoint<S>(self, entrypoint: impl IntoIterator<Item = S>) -> Self
where S: Serialize,

Source

pub fn capabilities<S>(self, capabilities: impl IntoIterator<Item = S>) -> Self
where S: Serialize,

Source

pub fn devices(self, devices: Vec<Labels>) -> Self

Source

pub fn log_driver(self, log_driver: impl Serialize) -> Self

Source

pub fn log_driver_config<K, V>( self, log_driver_config: impl IntoIterator<Item = (K, V)>, ) -> Self
where K: Serialize + Eq + Hash, V: Serialize,

Source

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

Source

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

Source

pub fn stop_signal(self, stop_signal: impl Serialize) -> Self

Signal to stop a container as a string. Default is "SIGTERM"

Source

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

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

Source

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

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

Source

pub fn userns_mode(self, userns_mode: impl Serialize) -> Self

Source

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

Source

pub fn user(self, user: impl Serialize) -> Self

Source

pub fn build(&self) -> ContainerCreateOpts

Source

pub fn hostname(self, hostname: impl Serialize) -> Self

The hostname to use for the container, as a valid RFC 1123 hostname.

Source

pub fn domainname(self, domainname: impl Serialize) -> Self

The domain name to use for the container.

Source

pub fn ipc(self, ipc: IpcMode) -> Self

IPC sharing mode for the container. Default is “private” or “shareable”, depending on daemon version.

Source

pub fn pid(self, pid: PidMode) -> Self

Set the PID (Process) Namespace mode for the container.

Source

pub fn network_config(self, network_config: NetworkingConfig) -> Self

Represents the container’s networking configuration for each of its interfaces.

Source

pub fn runtime(self, runtime: impl Serialize) -> Self

Runtime to use for this container like “nvidia”

Source

pub fn device_requests(self, device_requests: Vec<DeviceRequest>) -> Self

Requested list of available devices with capabilities

Trait Implementations§

Source§

impl Default for ContainerCreateOptsBuilder

Source§

fn default() -> ContainerCreateOptsBuilder

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