ContainerHostConfig class

The host configuration applied when the container was created.

This is the Dart model for Docker's HostConfig JSON object, which contains resource constraints, port bindings, volume mounts, and many other runtime settings.

Constructors

ContainerHostConfig({int? cpuShares, int? memory, String? cgroupParent, int? blkioWeight, List<ContainerBlkioWeightDevice>? blkioWeightDevice, List<ContainerBlkioDeviceRate>? blkioDeviceReadBps, List<ContainerBlkioDeviceRate>? blkioDeviceWriteBps, List<ContainerBlkioDeviceRate>? blkioDeviceReadIOps, List<ContainerBlkioDeviceRate>? blkioDeviceWriteIOps, int? cpuPeriod, int? cpuQuota, int? cpuRealtimePeriod, int? cpuRealtimeRuntime, String? cpusetCpus, String? cpusetMems, List<ContainerDeviceMapping>? devices, List<String>? deviceCgroupRules, List<ContainerDeviceRequest>? deviceRequests, int? kernelMemoryTCP, int? memoryReservation, int? memorySwap, int? memorySwappiness, int? nanoCpus, bool? oomKillDisable, bool? init, int? pidsLimit, List<ContainerUlimit>? ulimits, int? cpuCount, int? cpuPercent, int? ioMaximumIOps, int? ioMaximumBandwidth, List<String>? binds, String? containerIDFile, ContainerLogConfig? logConfig, String? networkMode, Map<String, List<ContainerPortBinding>?>? portBindings, ContainerRestartPolicy? restartPolicy, bool? autoRemove, String? volumeDriver, List<String>? volumesFrom, List<ContainerMountPoint>? mounts, List<int>? consoleSize, Map<String, String>? annotations, List<String>? capAdd, List<String>? capDrop, String? cgroupnsMode, List<String>? dns, List<String>? dnsOptions, List<String>? dnsSearch, List<String>? extraHosts, List<String>? groupAdd, String? ipcMode, String? cgroup, List<String>? links, int? oomScoreAdj, String? pidMode, bool? privileged, bool? publishAllPorts, bool? readonlyRootfs, List<String>? securityOpt, Map<String, String>? storageOpt, Map<String, String>? tmpfs, String? utsMode, String? usernsMode, int? shmSize, Map<String, String>? sysctls, String? runtime, String? isolation, List<String>? maskedPaths, List<String>? readonlyPaths})
Creates a ContainerHostConfig with the given fields.
const
ContainerHostConfig.fromJson(Map<String, dynamic> json)
Deserialises a ContainerHostConfig from Docker's JSON representation.
factory

Properties

annotations Map<String, String>?
OCI annotations.
final
autoRemove bool?
Whether Docker will remove the container when it exits.
final
binds List<String>?
Volume bind-mount strings in host:container:mode format.
final
blkioDeviceReadBps List<ContainerBlkioDeviceRate>?
Per-device read bandwidth limits (bytes per second).
final
blkioDeviceReadIOps List<ContainerBlkioDeviceRate>?
Per-device read IOPS limits.
final
blkioDeviceWriteBps List<ContainerBlkioDeviceRate>?
Per-device write bandwidth limits (bytes per second).
final
blkioDeviceWriteIOps List<ContainerBlkioDeviceRate>?
Per-device write IOPS limits.
final
blkioWeight int?
Block I/O weight (10–1000, or 0 for default).
final
blkioWeightDevice List<ContainerBlkioWeightDevice>?
Per-device block I/O weight settings.
final
capAdd List<String>?
Linux capabilities to add.
final
capDrop List<String>?
Linux capabilities to drop.
final
cgroup String?
cgroup v2 unified hierarchy path.
final
cgroupnsMode String?
cgroup namespace mode: 'host' or 'private'.
final
cgroupParent String?
cgroup parent for the container.
final
consoleSize List<int>?
Console size [rows, columns] (Windows only).
final
containerIDFile String?
Path to the file containing the container ID.
final
cpuCount int?
Windows-only: number of usable CPUs.
final
cpuPercent int?
Windows-only: percentage of CPU usage.
final
cpuPeriod int?
Length of the CPU CFS period in microseconds.
final
cpuQuota int?
CPU CFS quota in microseconds per cpuPeriod.
final
cpuRealtimePeriod int?
CPU real-time period in microseconds.
final
cpuRealtimeRuntime int?
CPU real-time runtime in microseconds.
final
cpusetCpus String?
CPUs to use, e.g. '0-3' or '1,3'.
final
cpusetMems String?
Memory nodes to use, e.g. '0-1'.
final
cpuShares int?
CPU shares relative to other containers (default 0 = unlimited).
final
deviceCgroupRules List<String>?
cgroup device rules applied to the container.
final
deviceRequests List<ContainerDeviceRequest>?
Generic device requests (e.g. for GPU access).
final
devices List<ContainerDeviceMapping>?
Host devices exposed inside the container.
final
dns List<String>?
Custom DNS servers.
final
dnsOptions List<String>?
DNS options passed to the container.
final
dnsSearch List<String>?
DNS search domains.
final
extraHosts List<String>?
Extra host entries added to /etc/hosts.
final
groupAdd List<String>?
Additional groups the container process belongs to.
final
hashCode int
The hash code for this object.
no setterinherited
init bool?
Run an init process inside the container.
final
ioMaximumBandwidth int?
Windows-only: maximum I/O bandwidth for the container's storage.
final
ioMaximumIOps int?
Windows-only: maximum IOPS for the container's storage.
final
ipcMode String?
IPC mode: 'shareable', 'private', or 'container:<name>'.
final
isolation String?
Windows-only: isolation technology, e.g. 'process' or 'hyperv'.
final
kernelMemoryTCP int?
Hard limit on the TCP memory for the container's kernel.
final
Container names to link to (legacy).
final
logConfig ContainerLogConfig?
Logging driver and its options.
final
maskedPaths List<String>?
Paths masked inside the container (made inaccessible).
final
memory int?
Memory limit in bytes (0 = unlimited).
final
memoryReservation int?
Soft memory limit in bytes.
final
memorySwap int?
Total memory + swap limit in bytes (-1 = unlimited).
final
memorySwappiness int?
Tune container memory swappiness (0100; -1 for host default).
final
mounts List<ContainerMountPoint>?
Mount points declared using the --mount syntax.
final
nanoCpus int?
CPU quota in units of 1e-9 CPUs.
final
networkMode String?
Network mode for the container, e.g. 'bridge', 'host', 'none', or a custom network name.
final
oomKillDisable bool?
Disable the OOM killer for this container.
final
oomScoreAdj int?
OOM score adjustment for the container process.
final
pidMode String?
PID namespace mode: 'host' or 'container:<name>'.
final
pidsLimit int?
Limit on the number of processes inside the container.
final
portBindings Map<String, List<ContainerPortBinding>?>?
Published port bindings: container port spec → list of host bindings.
final
privileged bool?
Whether to grant extended privileges to the container.
final
publishAllPorts bool?
Whether to publish all exposed ports to random host ports.
final
readonlyPaths List<String>?
Paths made read-only inside the container.
final
readonlyRootfs bool?
Whether to mount the container's root filesystem as read-only.
final
restartPolicy ContainerRestartPolicy?
Restart policy for the container.
final
runtime String?
OCI runtime to use, e.g. 'runc' or 'nvidia'.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
securityOpt List<String>?
Security options, e.g. ['no-new-privileges:true'].
final
shmSize int?
Size of /dev/shm in bytes.
final
storageOpt Map<String, String>?
Storage driver options.
final
sysctls Map<String, String>?
Sysctl settings for the container.
final
tmpfs Map<String, String>?
Tmpfs mounts: container path → options string.
final
ulimits List<ContainerUlimit>?
ulimits applied to the container.
final
usernsMode String?
User namespace mode: '' (default), 'host'.
final
utsMode String?
UTS namespace mode.
final
volumeDriver String?
Volume driver for volumes created by this container.
final
volumesFrom List<String>?
Container names from which to mount volumes.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited