oci_utils.go 650 B

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