docker-sdk-rust/docs/HostConfig.md
2025-06-16 16:37:36 +07:00

14 KiB

HostConfig

Properties

Name Type Description Notes
cpu_shares Option<i32> An integer value representing this container's relative CPU weight versus other containers. [optional]
memory Option<i64> Memory limit in bytes. [optional][default to 0]
cgroup_parent Option<String> 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. [optional]
blkio_weight Option<i32> Block IO weight (relative weight). [optional]
blkio_weight_device Option<Vecmodels::ResourcesBlkioWeightDeviceInner> Block IO weight (relative device weight) in the form: [{\"Path\": \"device_path\", \"Weight\": weight}] [optional]
blkio_device_read_bps Option<Vecmodels::ThrottleDevice> Limit read rate (bytes per second) from a device, in the form: [{\"Path\": \"device_path\", \"Rate\": rate}] [optional]
blkio_device_write_bps Option<Vecmodels::ThrottleDevice> Limit write rate (bytes per second) to a device, in the form: [{\"Path\": \"device_path\", \"Rate\": rate}] [optional]
blkio_device_read_i_ops Option<Vecmodels::ThrottleDevice> Limit read rate (IO per second) from a device, in the form: [{\"Path\": \"device_path\", \"Rate\": rate}] [optional]
blkio_device_write_i_ops Option<Vecmodels::ThrottleDevice> Limit write rate (IO per second) to a device, in the form: [{\"Path\": \"device_path\", \"Rate\": rate}] [optional]
cpu_period Option<i64> The length of a CPU period in microseconds. [optional]
cpu_quota Option<i64> Microseconds of CPU time that the container can get in a CPU period. [optional]
cpu_realtime_period Option<i64> The length of a CPU real-time period in microseconds. Set to 0 to allocate no time allocated to real-time tasks. [optional]
cpu_realtime_runtime Option<i64> The length of a CPU real-time runtime in microseconds. Set to 0 to allocate no time allocated to real-time tasks. [optional]
cpuset_cpus Option<String> CPUs in which to allow execution (e.g., 0-3, 0,1). [optional]
cpuset_mems Option<String> Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems. [optional]
devices Option<Vecmodels::DeviceMapping> A list of devices to add to the container. [optional]
device_cgroup_rules Option<Vec> a list of cgroup rules to apply to the container [optional]
device_requests Option<Vecmodels::DeviceRequest> A list of requests for devices to be sent to device drivers. [optional]
kernel_memory_tcp Option<i64> Hard limit for kernel TCP buffer memory (in bytes). Depending on the OCI runtime in use, this option may be ignored. It is no longer supported by the default (runc) runtime. This field is omitted when empty. [optional]
memory_reservation Option<i64> Memory soft limit in bytes. [optional]
memory_swap Option<i64> Total memory limit (memory + swap). Set as -1 to enable unlimited swap. [optional]
memory_swappiness Option<i64> Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100. [optional]
nano_cpus Option<i64> CPU quota in units of 10-9 CPUs. [optional]
oom_kill_disable Option<bool> Disable OOM Killer for the container. [optional]
init Option<bool> 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. [optional]
pids_limit Option<i64> Tune a container's PIDs limit. Set 0 or -1 for unlimited, or null to not change. [optional]
ulimits Option<Vecmodels::ResourcesUlimitsInner> A list of resource limits to set in the container. For example: {\"Name\": \"nofile\", \"Soft\": 1024, \"Hard\": 2048} [optional]
cpu_count Option<i64> The number of usable 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. [optional]
cpu_percent Option<i64> 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. [optional]
io_maximum_i_ops Option<i64> Maximum IOps for the container system drive (Windows only) [optional]
io_maximum_bandwidth Option<i64> Maximum IO in bytes per second for the container system drive (Windows only). [optional]
binds Option<Vec> A list of volume bindings for this container. Each volume binding is a string in one of these forms: - host-src:container-dest[:options] to bind-mount a host path into the container. Both host-src, and container-dest must be an absolute path. - volume-name:container-dest[:options] to bind-mount a volume managed by a volume driver into the container. container-dest must be an absolute path. options is an optional, comma-delimited list of: - nocopy disables automatic copying of data from the container path to the volume. The nocopy flag only applies to named volumes. - `[ro rw]mounts a volume read-only or read-write, respectively. If omitted or set torw, volumes are mounted read-write. - [z
container_id_file Option<String> Path to a file where the container ID is written [optional]
log_config Option<models::HostConfigAllOfLogConfig> [optional]
network_mode Option<String> 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.
port_bindings Option<std::collections::HashMap<String, Vecmodels::PortBinding>> 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. [optional]
restart_policy Option<models::RestartPolicy> [optional]
auto_remove Option<bool> Automatically remove the container when the container's process exits. This has no effect if RestartPolicy is set. [optional]
volume_driver Option<String> Driver that this container uses to mount volumes. [optional]
volumes_from Option<Vec> A list of volumes to inherit from another container, specified in the form `[:<ro rw>]`.
mounts Option<Vecmodels::Mount> Specification for mounts to be added to the container. [optional]
console_size Option<Vec> Initial console size, as an [height, width] array. [optional]
annotations Option<std::collections::HashMap<String, String>> Arbitrary non-identifying metadata attached to container and provided to the runtime when the container is started. [optional]
cap_add Option<Vec> A list of kernel capabilities to add to the container. Conflicts with option 'Capabilities'. [optional]
cap_drop Option<Vec> A list of kernel capabilities to drop from the container. Conflicts with option 'Capabilities'. [optional]
cgroupns_mode Option<String> cgroup namespace mode for the container. Possible values are: - \"private\": the container runs in its own private cgroup namespace - \"host\": use the host system's cgroup namespace If not specified, the daemon default is used, which can either be \"private\" or \"host\", depending on daemon version, kernel support and configuration. [optional]
dns Option<Vec> A list of DNS servers for the container to use. [optional]
dns_options Option<Vec> A list of DNS options. [optional]
dns_search Option<Vec> A list of DNS search domains. [optional]
extra_hosts Option<Vec> A list of hostnames/IP mappings to add to the container's /etc/hosts file. Specified in the form [\"hostname:IP\"]. [optional]
group_add Option<Vec> A list of additional groups that the container process will run as. [optional]
ipc_mode Option<String> 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<String> Cgroup to use for the container. [optional]
links Option<Vec> A list of links for the container in the form container_name:alias. [optional]
oom_score_adj Option<i32> An integer value containing the score given to the container in order to tune OOM killer preferences. [optional]
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
privileged Option<bool> Gives the container full access to the host. [optional]
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. [optional]
readonly_rootfs Option<bool> Mount the container's root filesystem as read only. [optional]
security_opt Option<Vec> A list of string values to customize labels for MLS systems, such as SELinux. [optional]
storage_opt Option<std::collections::HashMap<String, String>> Storage driver options for this container, in the form {\"size\": \"120G\"}. [optional]
tmpfs Option<std::collections::HashMap<String, String>> A map of container directories which should be replaced by tmpfs mounts, and their corresponding mount options. For example: { \"/run\": \"rw,noexec,nosuid,size=65536k\" } [optional]
uts_mode Option<String> UTS namespace to use for the container. [optional]
userns_mode Option<String> Sets the usernamespace mode for the container when usernamespace remapping option is enabled. [optional]
shm_size Option<i64> Size of /dev/shm in bytes. If omitted, the system uses 64MB. [optional]
sysctls Option<std::collections::HashMap<String, String>> A list of kernel parameters (sysctls) to set in the container. This field is omitted if not set. [optional]
runtime Option<String> Runtime to use with this container. [optional]
isolation Option<String> Isolation technology of the container. (Windows only) [optional]
masked_paths Option<Vec> The list of paths to be masked inside the container (this overrides the default set of paths). [optional]
readonly_paths Option<Vec> The list of paths to be set as read-only inside the container (this overrides the default set of paths). [optional]

[Back to Model list] [Back to API list] [Back to README]