Selaa lähdekoodia

Merge pull request #5709 from vieux/conflict_h_net

returns an error when using -h and --net
Michael Crosby 11 vuotta sitten
vanhempi
commit
da0686481c
1 muutettua tiedostoa jossa 5 lisäystä ja 0 poistoa
  1. 5 0
      runconfig/parse.go

+ 5 - 0
runconfig/parse.go

@@ -17,6 +17,7 @@ var (
 	ErrInvalidWorkingDirectory  = fmt.Errorf("The working directory is invalid. It needs to be an absolute path.")
 	ErrConflictAttachDetach     = fmt.Errorf("Conflicting options: -a and -d")
 	ErrConflictDetachAutoRemove = fmt.Errorf("Conflicting options: --rm and -d")
+	ErrConflictNetworkHostname  = fmt.Errorf("Conflicting options: -h and --net")
 )
 
 //FIXME Only used in tests
@@ -101,6 +102,10 @@ func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf
 		return nil, nil, cmd, ErrConflictDetachAutoRemove
 	}
 
+	if *flNetMode != "bridge" && *flHostname != "" {
+		return nil, nil, cmd, ErrConflictNetworkHostname
+	}
+
 	// If neither -d or -a are set, attach to everything by default
 	if flAttach.Len() == 0 && !*flDetach {
 		if !*flDetach {