pub struct DockerContainerConfig { /* private fields */ }Expand description
Every optional field left out is not managed (no regent’s defaults here, only docker’s)
Implementations§
Source§impl DockerContainerConfig
impl DockerContainerConfig
pub fn new(image: ContainerImage) -> Self
pub fn with_pull_policy(self, pull: PullPolicy) -> Self
Sourcepub fn with_pull_if_missing(self) -> Self
pub fn with_pull_if_missing(self) -> Self
Pull the image only if it is not present on the host (default, PullPolicy::Missing)
Sourcepub fn with_pull_never(self) -> Self
pub fn with_pull_never(self) -> Self
Never pull the image: a missing image makes the attribute non-compliant (PullPolicy::Never)
pub fn with_command(self, command: ContainerCommand) -> Self
pub fn with_entrypoint(self, entrypoint: &str) -> Self
pub fn with_env(self, key: EnvVarName, value: Parameter<String>) -> Self
pub fn with_volumes(self, volumes: Vec<ContainerVolume>) -> Self
pub fn with_networking(self, networking: DockerNetworking) -> Self
Sourcepub fn with_host_networking(self) -> Self
pub fn with_host_networking(self) -> Self
Share the host network stack (--network host). Replaces the networks and published
ports set before.
Sourcepub fn with_isolated_networking(self) -> Self
pub fn with_isolated_networking(self) -> Self
No network at all (--network none). Replaces the networks and published ports set
before.
Sourcepub fn with_network(self, network: NetworkName) -> Self
pub fn with_network(self, network: NetworkName) -> Self
Attach the container to a network, after the networks added before (the first one is
used at creation). Replaces Host or Isolated networking.
Sourcepub fn with_published_port(self, port: PublishedPort) -> Self
pub fn with_published_port(self, port: PublishedPort) -> Self
Publish a port, in addition to the ports published before. Ports can only be published
on attached networking: replaces Host or Isolated networking.
pub fn with_restart_policy(self, restart_policy: RestartPolicy) -> Self
Sourcepub fn with_restart_never(self) -> Self
pub fn with_restart_never(self) -> Self
Never restart the container (--restart no)
Sourcepub fn with_restart_always(self) -> Self
pub fn with_restart_always(self) -> Self
Always restart the container (--restart always)
Sourcepub fn with_restart_unless_stopped(self) -> Self
pub fn with_restart_unless_stopped(self) -> Self
Restart the container unless it was stopped (--restart unless-stopped)
Sourcepub fn with_restart_on_failure(self, max_retries: u32) -> Self
pub fn with_restart_on_failure(self, max_retries: u32) -> Self
Restart the container when it fails, at most max_retries times (0 means unlimited,
--restart on-failure[:max-retries])
pub fn with_hostname(self, hostname: &str) -> Self
pub fn with_user(self, user: &str) -> Self
pub fn with_working_dir(self, working_dir: &str) -> Self
pub fn with_label(self, key: &str, value: &str) -> Self
pub fn with_privileged(self, privileged: bool) -> Self
pub fn with_read_only(self, read_only: bool) -> Self
pub fn with_init(self, init: bool) -> Self
pub fn with_cap_add(self, capabilities: Vec<Capability>) -> Self
pub fn with_cap_drop(self, capabilities: Vec<Capability>) -> Self
pub fn with_memory(self, memory: MemorySize) -> Self
pub fn with_cpus(self, cpus: CpuCount) -> Self
pub fn with_extra_hosts(self, extra_hosts: Vec<ExtraHost>) -> Self
pub fn with_dns(self, dns: Vec<IpAddr>) -> Self
pub fn with_devices(self, devices: Vec<HostDevice>) -> Self
pub fn with_gpus(self, gpus: GpuSelection) -> Self
Sourcepub fn with_all_gpus(self) -> Self
pub fn with_all_gpus(self) -> Self
Give all the GPUs to the container (--gpus all). Replaces the devices added before.
Sourcepub fn with_gpu_device(self, gpu: GpuId) -> Self
pub fn with_gpu_device(self, gpu: GpuId) -> Self
Give a GPU to the container, in addition to the devices added before. Replaces
with_all_gpus().
pub fn with_ipc(self, ipc: IpcNamespace) -> Self
Sourcepub fn with_host_ipc(self) -> Self
pub fn with_host_ipc(self) -> Self
Share the host IPC namespace and /dev/shm (--ipc host). Replaces a private namespace
and its /dev/shm size.
Sourcepub fn with_private_ipc(self) -> Self
pub fn with_private_ipc(self) -> Self
Own IPC namespace (--ipc private). Replaces the host namespace, keeps the /dev/shm
size set before.
Own IPC namespace which other containers can join (--ipc shareable). Replaces the host
namespace, keeps the /dev/shm size set before.
Sourcepub fn with_shm_size(self, shm_size: MemorySize) -> Self
pub fn with_shm_size(self, shm_size: MemorySize) -> Self
Size of /dev/shm (--shm-size), which only exists in the container’s own IPC
namespace: replaces the host namespace by a private one (a shareable namespace stays
shareable).