pub struct HostConfig<T>where
    T: AsRef<str> + Eq + Hash,
{
Show 63 fields pub binds: Option<Vec<T>>, pub links: Option<Vec<T>>, pub memory: Option<u64>, pub memory_swap: Option<i64>, pub memory_reservation: Option<u64>, pub kernel_memory: Option<u64>, pub nano_cpus: Option<u64>, pub cpu_percent: Option<u64>, pub cpu_shares: Option<u64>, pub cpu_period: Option<u64>, pub cpu_realtime_period: Option<u64>, pub cpu_realtime_runtime: Option<u64>, pub cpu_quota: Option<u64>, pub cpuset_cpus: Option<T>, pub cpuset_mems: Option<T>, pub blkio_weight: Option<u64>, pub blkio_weight_device: Option<Vec<HashMap<T, T>>>, pub blkio_device_read_bps: Option<Vec<HashMap<T, T>>>, pub blkio_device_write_bps: Option<Vec<HashMap<T, T>>>, pub blkio_device_read_iops: Option<Vec<HashMap<T, T>>>, pub blkio_device_write_iops: Option<Vec<HashMap<T, T>>>, pub memory_swappiness: Option<u64>, pub oom_kill_disable: Option<bool>, pub oom_score_adj: Option<isize>, pub pid_mode: Option<String>, pub pids_limit: Option<u64>, pub port_bindings: Option<HashMap<T, Vec<PortBinding<T>>>>, pub publish_all_ports: Option<bool>, pub privileged: Option<bool>, pub readonly_rootfs: Option<bool>, pub dns: Option<Vec<T>>, pub dns_options: Option<Vec<T>>, pub dns_search: Option<Vec<T>>, pub volumes_from: Option<Vec<T>>, pub cap_add: Option<Vec<T>>, pub cap_drop: Option<Vec<T>>, pub group_add: Option<Vec<T>>, pub restart_policy: Option<RestartPolicy<T>>, pub auto_remove: Option<bool>, pub network_mode: Option<T>, pub devices: Option<Vec<T>>, pub ulimits: Option<Vec<HashMap<T, T>>>, pub log_config: Option<LogConfig>, pub security_opt: Option<Vec<T>>, pub cgroup_parent: Option<T>, pub volume_driver: Option<T>, pub shm_size: Option<u64>, pub container_id_file: Option<String>, pub extra_hosts: Option<Vec<T>>, pub ipc_mode: Option<T>, pub cgroup: Option<T>, pub uts_mode: Option<T>, pub userns_mode: Option<T>, pub runtime: Option<T>, pub console_size: Option<Vec<isize>>, pub isolation: Option<T>, pub device_cgroup_rules: Option<Vec<T>>, pub disk_quota: Option<u64>, pub cpu_count: Option<u64>, pub io_maximum_iops: Option<u64>, pub io_maximum_bandwidth: Option<u64>, pub masked_paths: Option<Vec<T>>, pub readonly_paths: Option<Vec<T>>,
}
Expand description

Container configuration that depends on the host we are running on

Fields§

§binds: Option<Vec<T>>

A list of volume bindings for this container. Each volume binding is a string in one of these forms:

  • host-src:container-dest to bind-mount a host path into the container. Both host-src, and container-dest must be an absolute path.
  • host-src:container-dest:ro to make the bind mount read-only inside the container. Both host-src, and container-dest must be an absolute path.
  • volume-name:container-dest to bind-mount a volume managed by a volume driver into the container. container-dest must be an absolute path.
  • volume-name:container-dest:ro to mount the volume read-only inside the container. container-dest must be an absolute path.
§links: Option<Vec<T>>

A list of links for the container in the form container_name:alias.

§memory: Option<u64>

Memory limit in bytes.

§memory_swap: Option<i64>

Total memory limit (memory + swap). Set as -1 to enable unlimited swap.

§memory_reservation: Option<u64>

Memory soft limit in bytes.

§kernel_memory: Option<u64>

Kernel memory limit in bytes.

§nano_cpus: Option<u64>

CPU quota in units of 10-9 CPUs.

§cpu_percent: Option<u64>§cpu_shares: Option<u64>

An integer value representing this container’s relative CPU weight versus other containers.

§cpu_period: Option<u64>

The length of a CPU period in microseconds.

§cpu_realtime_period: Option<u64>

The length of a CPU real-time period in microseconds. Set to 0 to allocate no time allocated to real-time tasks.

§cpu_realtime_runtime: Option<u64>

The length of a CPU real-time runtime in microseconds. Set to 0 to allocate no time allocated to real-time tasks.

§cpu_quota: Option<u64>

Microseconds of CPU time that the container can get in a CPU period.

§cpuset_cpus: Option<T>

CPUs in which to allow execution (e.g., 0-3, 0,1)

§cpuset_mems: Option<T>

Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.

§blkio_weight: Option<u64>

Block IO weight (relative weight).

§blkio_weight_device: Option<Vec<HashMap<T, T>>>

Block IO weight (relative device weight).

§blkio_device_read_bps: Option<Vec<HashMap<T, T>>>

Limit read rate (bytes per second) from a device.

§blkio_device_write_bps: Option<Vec<HashMap<T, T>>>

Limit write rate (bytes per second) to a device.

§blkio_device_read_iops: Option<Vec<HashMap<T, T>>>

Limit read rate (IO per second) from a device.

§blkio_device_write_iops: Option<Vec<HashMap<T, T>>>

Limit write rate (IO per second) to a device.

§memory_swappiness: Option<u64>

Tune a container’s memory swappiness behavior. Accepts an integer between 0 and 100.

§oom_kill_disable: Option<bool>

Disable OOM Killer for the container.

§oom_score_adj: Option<isize>

An integer value containing the score given to the container in order to tune OOM killer preferences.

§pid_mode: Option<String>

Set the PID (Process) Namespace mode for the container. It can be either:

  • "container:<name|id>": joins another container’s PID namespace
  • "host": use the host’s PID namespace inside the container
§pids_limit: Option<u64>

Tune a container’s pids limit. Set -1 for unlimited.

§port_bindings: Option<HashMap<T, Vec<PortBinding<T>>>>

PortMap describes the mapping of container ports to host ports, using the container’s port-number and protocol as key in the format <port>/<protocol>, for example, 80/udp. If a container’s port is mapped for multiple protocols, separate entries are added to the mapping table.

§publish_all_ports: Option<bool>

Allocates an ephemeral host port for all of a container’s exposed ports. Ports are de-allocated when the container stops and allocated when the container starts. The allocated port might be changed when restarting the container.
The port is selected from the ephemeral port range that depends on the kernel. For example, on Linux the range is defined by /proc/sys/net/ipv4/ip_local_port_range.

§privileged: Option<bool>

Gives the container full access to the host.

§readonly_rootfs: Option<bool>

Mount the container’s root filesystem as read only.

§dns: Option<Vec<T>>

A list of DNS servers for the container to use.

§dns_options: Option<Vec<T>>

A list of DNS options.

§dns_search: Option<Vec<T>>

A list of DNS search domains.

§volumes_from: Option<Vec<T>>

A list of volumes to inherit from another container, specified in the form <container name>[:<ro|rw>].

§cap_add: Option<Vec<T>>

A list of kernel capabilities to add to the container.

§cap_drop: Option<Vec<T>>

A list of kernel capabilities to drop from the container.

§group_add: Option<Vec<T>>§restart_policy: Option<RestartPolicy<T>>

The behavior to apply when the container exits. The default is not to restart. An ever increasing delay (double the previous delay, starting at 100ms) is added before each restart to prevent flooding the server.

§auto_remove: Option<bool>

Automatically remove the container when the container’s process exits. This has no effect if RestartPolicy is set.

§network_mode: Option<T>

Network mode to use for this container. Supported standard values are: bridge, host, none, and container:<name|id>. Any other value is taken as a custom network’s name to which this container should connect to.

§devices: Option<Vec<T>>§ulimits: Option<Vec<HashMap<T, T>>>

A list of resource limits to set in the container. For example: {"Name": "nofile", "Soft": 1024, "Hard": 2048}

§log_config: Option<LogConfig>

The logging configuration for this container.

§security_opt: Option<Vec<T>>

A list of string values to customize labels for MLS systems, such as SELinux.

§cgroup_parent: Option<T>

Path to cgroups under which the container’s cgroup is created. If the path is not absolute, the path is considered to be relative to the cgroups path of the init process. Cgroups are created if they do not already exist.

§volume_driver: Option<T>

Driver that this container uses to mount volumes.

§shm_size: Option<u64>

Size of /dev/shm in bytes. If omitted, the system uses 64MB.

§container_id_file: Option<String>

Path to a file where the container ID is written.

§extra_hosts: Option<Vec<T>>

A list of hostnames/IP mappings to add to the container’s /etc/hosts file. Specified in the form ["hostname:IP"].

§ipc_mode: Option<T>

IPC sharing mode for the container. Possible values are:

  • "none": own private IPC namespace, with /dev/shm not mounted
  • "private": own private IPC namespace
  • "shareable": own private IPC namespace, with a possibility to share it with other containers
  • "container:<name|id>": join another (shareable) container’s IPC namespace
  • "host": use the host system’s IPC namespace If not specified, daemon default is used, which can either be “private” or “shareable”, depending on daemon version and configuration.
§cgroup: Option<T>

Cgroup to use for the container.

§uts_mode: Option<T>

UTS namespace to use for the container.

§userns_mode: Option<T>

Sets the usernamespace mode for the container when usernamespace remapping option is enabled.

§runtime: Option<T>

Runtime to use with this container.

§console_size: Option<Vec<isize>>

Initial console size, as an [height, width] array. (Windows only)

§isolation: Option<T>

Isolation technology of the container. (Windows only)

§device_cgroup_rules: Option<Vec<T>>

A list of cgroup rules to apply to the container.

§disk_quota: Option<u64>

Disk limit (in bytes).

§cpu_count: Option<u64>

The usable percentage of the available CPUs (Windows only). On Windows Server containers, the processor resource controls are mutually exclusive. The order of precedence is CPUCount first, then CPUShares, and CPUPercent last.

§io_maximum_iops: Option<u64>

Maximum IOps for the container system drive (Windows only).

§io_maximum_bandwidth: Option<u64>

Maximum IO in bytes per second for the container system drive (Windows only).

§masked_paths: Option<Vec<T>>§readonly_paths: Option<Vec<T>>

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.