Browse Source

Merge remote-tracking branch 'sa2ajj/hostname-parameter'

Solomon Hykes 12 years ago
parent
commit
d6fb2a0836
2 changed files with 6 additions and 1 deletions
  1. 5 1
      container.go
  2. 1 0
      docs/sources/commandline/cli.rst

+ 5 - 1
container.go

@@ -67,16 +67,19 @@ func ParseRun(args []string, stdout io.Writer) (*Config, error) {
 		cmd.SetOutput(ioutil.Discard)
 		cmd.SetOutput(ioutil.Discard)
 	}
 	}
 
 
+	flHostname := cmd.String("h", "", "Container host name")
 	flUser := cmd.String("u", "", "Username or UID")
 	flUser := cmd.String("u", "", "Username or UID")
 	flDetach := cmd.Bool("d", false, "Detached mode: leave the container running in the background")
 	flDetach := cmd.Bool("d", false, "Detached mode: leave the container running in the background")
 	flStdin := cmd.Bool("i", false, "Keep stdin open even if not attached")
 	flStdin := cmd.Bool("i", false, "Keep stdin open even if not attached")
 	flTty := cmd.Bool("t", false, "Allocate a pseudo-tty")
 	flTty := cmd.Bool("t", false, "Allocate a pseudo-tty")
 	flMemory := cmd.Int64("m", 0, "Memory limit (in bytes)")
 	flMemory := cmd.Int64("m", 0, "Memory limit (in bytes)")
-	var flPorts ports
 
 
+	var flPorts ports
 	cmd.Var(&flPorts, "p", "Map a network port to the container")
 	cmd.Var(&flPorts, "p", "Map a network port to the container")
+
 	var flEnv ListOpts
 	var flEnv ListOpts
 	cmd.Var(&flEnv, "e", "Set environment variables")
 	cmd.Var(&flEnv, "e", "Set environment variables")
+
 	if err := cmd.Parse(args); err != nil {
 	if err := cmd.Parse(args); err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
@@ -90,6 +93,7 @@ func ParseRun(args []string, stdout io.Writer) (*Config, error) {
 		runCmd = parsedArgs[1:]
 		runCmd = parsedArgs[1:]
 	}
 	}
 	config := &Config{
 	config := &Config{
+		Hostname:  *flHostname,
 		Ports:     flPorts,
 		Ports:     flPorts,
 		User:      *flUser,
 		User:      *flUser,
 		Tty:       *flTty,
 		Tty:       *flTty,

+ 1 - 0
docs/sources/commandline/cli.rst

@@ -264,6 +264,7 @@ run
     -m=0: Memory limit (in bytes)
     -m=0: Memory limit (in bytes)
     -p=[]: Map a network port to the container
     -p=[]: Map a network port to the container
     -t=false: Allocate a pseudo-tty
     -t=false: Allocate a pseudo-tty
+    -h="": Container host name
     -u="": Username or UID
     -u="": Username or UID