Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.4:ARM
docker.11536
bsc1001161-0001-oci-include-the-domainname-in-k...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bsc1001161-0001-oci-include-the-domainname-in-kernel.domainname.patch of Package docker.11536
From a3e63ddd20b7f52ff5e81bdb1beb867d28a1c9c8 Mon Sep 17 00:00:00 2001 From: Aleksa Sarai <asarai@suse.de> Date: Sun, 17 Jun 2018 17:05:54 +1000 Subject: [PATCH 1/2] oci: include the domainname in "kernel.domainname" The OCI doesn't have a specific field for an NIS domainname[1] (mainly because FreeBSD and Solaris appear to have a similar concept but it is configured entirely differently). However, on Linux, the NIS domainname can be configured through both the setdomainname(2) syscall but also through the "kernel.domainname" sysctl. Since the OCI has a way of injecting sysctls this means we don't need to have any OCI changes to support NIS domainnames (and we can always switch if the OCI picks up such support in the future). It should be noted that because we have to generate this each spec creation we also have to make sure that it's not clobbered by the HostConfig. I'm pretty sure making this change generic (so that HostConfig will not clobber any pre-set sysctls) will not cause other issues to crop up. [1]: https://github.com/opencontainers/runtime-spec/issues/592 SUSE-Bugs: bsc#1001161 Signed-off-by: Aleksa Sarai <asarai@suse.de> --- components/engine/daemon/oci_linux.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/components/engine/daemon/oci_linux.go b/components/engine/daemon/oci_linux.go index 7611fc054d13..d5838623528e 100644 --- a/components/engine/daemon/oci_linux.go +++ b/components/engine/daemon/oci_linux.go @@ -679,7 +679,15 @@ func (daemon *Daemon) populateCommonSpec(s *specs.Spec, c *container.Container) s.Process.Cwd = cwd s.Process.Env = c.CreateDaemonEnvironment(c.Config.Tty, linkedEnv) s.Process.Terminal = c.Config.Tty - s.Hostname = c.FullHostname() + + s.Hostname = c.Config.Hostname + // There isn't a field in the OCI for the NIS domainname, but luckily there + // is a sysctl which has an identical effect to setdomainname(2) so there's + // no explicit need for runtime support. + s.Linux.Sysctl = make(map[string]string) + if c.Config.Domainname != "" { + s.Linux.Sysctl["kernel.domainname"] = c.Config.Domainname + } return nil } @@ -715,7 +723,11 @@ func (daemon *Daemon) createSpec(c *container.Container) (retSpec *specs.Spec, e if err := setResources(&s, c.HostConfig.Resources); err != nil { return nil, fmt.Errorf("linux runtime spec resources: %v", err) } - s.Linux.Sysctl = c.HostConfig.Sysctls + // We merge the sysctls injected above with the HostConfig (latter takes + // precedence for backwards-compatibility reasons). + for k, v := range c.HostConfig.Sysctls { + s.Linux.Sysctl[k] = v + } p := s.Linux.CgroupsPath if useSystemd { -- 2.21.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor