@@ -375,7 +375,8 @@ func (m *containerNetworkManager) VerifyNetworkOptions(_ context.Context) error
375375
376376 // Note that mac-address is accepted, though it is a no-op
377377 nonZeroParams := nonZeroMapValues (map [string ]interface {}{
378- "--hostname" : m .netOpts .Hostname ,
378+ "--hostname" : m .netOpts .Hostname ,
379+ "--domainname" : m .netOpts .Domainname ,
379380 // NOTE: an empty slice still counts as a non-zero value so we check its length:
380381 "-p/--publish" : len (m .netOpts .PortMappings ) != 0 ,
381382 "--dns" : len (m .netOpts .DNSServers ) != 0 ,
@@ -736,6 +737,9 @@ func (m *hostNetworkManager) ContainerNetworkingOpts(_ context.Context, containe
736737 if hostnameOpts != nil {
737738 specs = append (specs , hostnameOpts ... )
738739 }
740+ if m .netOpts .Domainname != "" {
741+ specs = append (specs , oci .WithDomainname (m .netOpts .Domainname ))
742+ }
739743 }
740744
741745 if rootlessutil .IsRootless () {
@@ -803,9 +807,9 @@ func validateUtsSettings(netOpts types.NetworkOptions) error {
803807 }
804808
805809 // Docker considers this a validation error so keep compat.
806- // https://docs.docker.com/engine/ reference/run/#uts-settings--- uts
807- if utsNamespace == UtsNamespaceHost && netOpts .Hostname != "" {
808- return fmt .Errorf ("conflicting options: cannot set a --hostname with --uts=host" )
810+ // https://docs.docker.com/reference/cli/docker/container/ run/#uts
811+ if utsNamespace == UtsNamespaceHost && ( netOpts .Hostname != "" || netOpts . Domainname != "" ) {
812+ return fmt .Errorf ("conflicting options: cannot set --hostname and/or --domainname with --uts=host" )
809813 }
810814
811815 return nil
0 commit comments