github.com/toplink-cn/moby@v0.0.0-20240305205811-460b4aebdf81/daemon/oci_utils.go (about) 1 package daemon // import "github.com/docker/docker/daemon" 2 3 import ( 4 "github.com/docker/docker/container" 5 specs "github.com/opencontainers/runtime-spec/specs-go" 6 ) 7 8 func setLinuxDomainname(c *container.Container, s *specs.Spec) { 9 // There isn't a field in the OCI for the NIS domainname, but luckily there 10 // is a sysctl which has an identical effect to setdomainname(2) so there's 11 // no explicit need for runtime support. 12 if s.Linux == nil { 13 s.Linux = &specs.Linux{} 14 } 15 if s.Linux.Sysctl == nil { 16 s.Linux.Sysctl = make(map[string]string) 17 } 18 if c.Config.Domainname != "" { 19 s.Linux.Sysctl["kernel.domainname"] = c.Config.Domainname 20 } 21 }