@@ -143,29 +143,30 @@ type Container struct {
143143// From https://github.com/moby/moby/blob/8dbd90ec00daa26dc45d7da2431c965dec99e8b4/api/types/container/host_config.go#L391
144144// HostConfig the non-portable Config structure of a container.
145145type HostConfig struct {
146- ExtraHosts []string // List of extra hosts
147- PortBindings nat.PortMap // Port mapping between the exposed port (container) and the host
148- LogConfig LogConfig // Configuration of the logs for this container
149- BlkioWeight uint16 // Block IO weight (relative weight vs. other containers)
150- CPUSetMems string `json:"CpusetMems"` // CpusetMems 0-2, 0,1
151- CPUSetCPUs string `json:"CpusetCpus"` // CpusetCpus 0-2, 0,1
152- CPUQuota int64 `json:"CpuQuota"` // CPU CFS (Completely Fair Scheduler) quota
153- CPUShares uint64 `json:"CpuShares"` // CPU shares (relative weight vs. other containers)
154- ContainerIDFile string // File (path) where the containerId is written
155- GroupAdd []string // GroupAdd specifies additional groups to join
156- IpcMode string // IPC namespace to use for the container
157- CgroupnsMode string // Cgroup namespace mode to use for the container
158- Memory int64 // Memory limit (in bytes)
159- MemorySwap int64 // Total memory usage (memory + swap); set `-1` to enable unlimited swap
160- OomKillDisable bool // specifies whether to disable OOM Killer
161- DNS []string `json:"Dns"` // List of DNS server to lookup
162- DNSOptions []string `json:"DnsOptions"` // List of DNSOption to look for
163- DNSSearch []string `json:"DnsSearch"` // List of DNSSearch to look for
164- OomScoreAdj int // specifies the tune container’s OOM preferences (-1000 to 1000, rootless: 100 to 1000)
165- ReadonlyRootfs bool // Is the container root filesystem in read-only
166- UTSMode string // UTS namespace to use for the container
167- ShmSize int64 // Size of /dev/shm in bytes. The size must be greater than 0.
168-
146+ ExtraHosts []string // List of extra hosts
147+ PortBindings nat.PortMap // Port mapping between the exposed port (container) and the host
148+ LogConfig LogConfig // Configuration of the logs for this container
149+ BlkioWeight uint16 // Block IO weight (relative weight vs. other containers)
150+ CPUSetMems string `json:"CpusetMems"` // CpusetMems 0-2, 0,1
151+ CPUSetCPUs string `json:"CpusetCpus"` // CpusetCpus 0-2, 0,1
152+ CPUQuota int64 `json:"CpuQuota"` // CPU CFS (Completely Fair Scheduler) quota
153+ CPUShares uint64 `json:"CpuShares"` // CPU shares (relative weight vs. other containers)
154+ ContainerIDFile string // File (path) where the containerId is written
155+ GroupAdd []string // GroupAdd specifies additional groups to join
156+ IpcMode string // IPC namespace to use for the container
157+ CgroupnsMode string // Cgroup namespace mode to use for the container
158+ Memory int64 // Memory limit (in bytes)
159+ MemorySwap int64 // Total memory usage (memory + swap); set `-1` to enable unlimited swap
160+ OomKillDisable bool // specifies whether to disable OOM Killer
161+ DNS []string `json:"Dns"` // List of DNS server to lookup
162+ DNSOptions []string `json:"DnsOptions"` // List of DNSOption to look for
163+ DNSSearch []string `json:"DnsSearch"` // List of DNSSearch to look for
164+ OomScoreAdj int // specifies the tune container’s OOM preferences (-1000 to 1000, rootless: 100 to 1000)
165+ ReadonlyRootfs bool // Is the container root filesystem in read-only
166+ UTSMode string // UTS namespace to use for the container
167+ ShmSize int64 // Size of /dev/shm in bytes. The size must be greater than 0.
168+ Sysctls map [string ]string // List of Namespaced sysctls used for the container
169+ Runtime string // Runtime to use with this container
169170}
170171
171172// From https://github.com/moby/moby/blob/v20.10.1/api/types/types.go#L416-L427
@@ -466,6 +467,13 @@ func ContainerFromNative(n *native.Container) (*Container, error) {
466467 shmSize , _ := getShmSizeFromNative (n .Spec .(* specs.Spec ))
467468 c .HostConfig .ShmSize = shmSize
468469
470+ sysctls , _ := getSysctlFromNative (n .Spec .(* specs.Spec ))
471+ c .HostConfig .Sysctls = sysctls
472+
473+ if n .Runtime .Name != "" {
474+ c .HostConfig .Runtime = n .Runtime .Name
475+ }
476+
469477 c .State = cs
470478 c .Config = & Config {
471479 Labels : n .Labels ,
@@ -787,6 +795,14 @@ func getShmSizeFromNative(sp *specs.Spec) (int64, error) {
787795 return res , nil
788796}
789797
798+ func getSysctlFromNative (sp * specs.Spec ) (map [string ]string , error ) {
799+ var res map [string ]string
800+ if sp .Linux != nil && sp .Linux .Sysctl != nil {
801+ res = sp .Linux .Sysctl
802+ }
803+ return res , nil
804+ }
805+
790806type IPAMConfig struct {
791807 Subnet string `json:"Subnet,omitempty"`
792808 Gateway string `json:"Gateway,omitempty"`
0 commit comments