From e0221c825595ca1ddb06086e76371fbf02ea7640 Mon Sep 17 00:00:00 2001 From: utam0k Date: Sun, 11 Sep 2022 09:47:58 +0900 Subject: [PATCH] Implement to set a domain name Signed-off-by: utam0k --- libcontainer/standard_init_linux.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libcontainer/standard_init_linux.go b/libcontainer/standard_init_linux.go index 6ad25c9a4df..4b84974ec6b 100644 --- a/libcontainer/standard_init_linux.go +++ b/libcontainer/standard_init_linux.go @@ -126,6 +126,11 @@ func (l *linuxStandardInit) Init() error { return &os.SyscallError{Syscall: "sethostname", Err: err} } } + if domainname := l.config.Config.Domainname; domainname != "" { + if err := unix.Setdomainname([]byte(domainname)); err != nil { + return &os.SyscallError{Syscall: "setdomainname", Err: err} + } + } if err := apparmor.ApplyProfile(l.config.AppArmorProfile); err != nil { return fmt.Errorf("unable to apply apparmor profile: %w", err) }