@@ -209,7 +209,8 @@ func (m *containerNetworkManager) VerifyNetworkOptions(_ context.Context) error
209209
210210 // Note that mac-address is accepted, though it is a no-op
211211 nonZeroParams := nonZeroMapValues (map [string ]interface {}{
212- "--hostname" : m .netOpts .Hostname ,
212+ "--hostname" : m .netOpts .Hostname ,
213+ "--domainname" : m .netOpts .Domainname ,
213214 // NOTE: an empty slice still counts as a non-zero value so we check its length:
214215 "-p/--publish" : len (m .netOpts .PortMappings ) != 0 ,
215216 "--dns" : len (m .netOpts .DNSServers ) != 0 ,
@@ -576,6 +577,9 @@ func (m *hostNetworkManager) ContainerNetworkingOpts(_ context.Context, containe
576577 if hostnameOpts != nil {
577578 specs = append (specs , hostnameOpts ... )
578579 }
580+ if m .netOpts .Domainname != "" {
581+ specs = append (specs , oci .WithDomainname (m .netOpts .Domainname ))
582+ }
579583 }
580584
581585 if rootlessutil .IsRootless () {
@@ -643,9 +647,9 @@ func validateUtsSettings(netOpts types.NetworkOptions) error {
643647 }
644648
645649 // Docker considers this a validation error so keep compat.
646- // https://docs.docker.com/engine/ reference/run/#uts-settings--- uts
647- if utsNamespace == UtsNamespaceHost && netOpts .Hostname != "" {
648- return fmt .Errorf ("conflicting options: cannot set a --hostname with --uts=host" )
650+ // https://docs.docker.com/reference/cli/docker/container/ run/#uts
651+ if utsNamespace == UtsNamespaceHost && ( netOpts .Hostname != "" || netOpts . Domainname != "" ) {
652+ return fmt .Errorf ("conflicting options: cannot set --hostname and/or --domainname with --uts=host" )
649653 }
650654
651655 return nil
0 commit comments