pub struct ContainerSpec { /* private fields */ }Expand description
What to run in a container, and how it joins its case scope.
Implementations§
Source§impl ContainerSpec
impl ContainerSpec
Sourcepub fn new(image: impl Into<String>) -> Self
pub fn new(image: impl Into<String>) -> Self
Creates a spec that runs image with its own entrypoint and command.
Sourcepub fn with_entrypoint(self, entrypoint: Vec<String>) -> Self
pub fn with_entrypoint(self, entrypoint: Vec<String>) -> Self
Replaces the image’s entrypoint.
Sourcepub fn with_command(self, command: Vec<String>) -> Self
pub fn with_command(self, command: Vec<String>) -> Self
Replaces the image’s command.
Sourcepub fn with_env_var(self, key: impl AsRef<str>, value: impl AsRef<str>) -> Self
pub fn with_env_var(self, key: impl AsRef<str>, value: impl AsRef<str>) -> Self
Adds an environment variable.
Sourcepub fn with_published_port(self, port: u16) -> Self
pub fn with_published_port(self, port: u16) -> Self
Publishes a TCP port of the container on the runner’s 127.0.0.1, at a host port Docker chooses.
Sourcepub fn with_bind(
self,
host: impl Into<String>,
path: impl Into<String>,
read_only: bool,
) -> Self
pub fn with_bind( self, host: impl Into<String>, path: impl Into<String>, read_only: bool, ) -> Self
Mounts the host path host at path in the container. Creating the container fails if host does not exist.
Sourcepub fn with_sysctl(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_sysctl( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Sets a kernel parameter in the container’s namespaces, such as net.ipv4.ip_local_port_range.
Sourcepub fn with_host_pid(self) -> Self
pub fn with_host_pid(self) -> Self
Runs the container in the host’s PID namespace.
Sourcepub fn with_host_cgroup_namespace(self) -> Self
pub fn with_host_cgroup_namespace(self) -> Self
Runs the container in the host’s cgroup namespace.
Trait Implementations§
Source§impl Clone for ContainerSpec
impl Clone for ContainerSpec
Source§fn clone(&self) -> ContainerSpec
fn clone(&self) -> ContainerSpec
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContainerSpec
impl Debug for ContainerSpec
Source§impl Default for ContainerSpec
impl Default for ContainerSpec
Source§fn default() -> ContainerSpec
fn default() -> ContainerSpec
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ContainerSpec
impl RefUnwindSafe for ContainerSpec
impl Send for ContainerSpec
impl Sync for ContainerSpec
impl Unpin for ContainerSpec
impl UnsafeUnpin for ContainerSpec
impl UnwindSafe for ContainerSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more