Browse code

Pretty the help text

This modifies the "docker help" text so that it is no wider than 80 chars
and each description fits on one line. This will also try to use ~ when
possible

Added a test to make sure we don't go over 80 chars again.
Added a test to make sure we use ~

Applied rules/tests to all docker commands - not just main help text

Closes #10214

Signed-off-by: Doug Davis <dug@us.ibm.com>

Doug Davis authored on 2015/02/04 12:51:35
Showing 9 changed files
... ...
@@ -79,13 +79,13 @@ func (cli *DockerCli) CmdHelp(args ...string) error {
79 79
 
80 80
 func (cli *DockerCli) CmdBuild(args ...string) error {
81 81
 	cmd := cli.Subcmd("build", "PATH | URL | -", "Build a new image from the source code at PATH", true)
82
-	tag := cmd.String([]string{"t", "-tag"}, "", "Repository name (and optionally a tag) to be applied to the resulting image in case of success")
82
+	tag := cmd.String([]string{"t", "-tag"}, "", "Repository name (and optionally a tag) for the image")
83 83
 	suppressOutput := cmd.Bool([]string{"q", "-quiet"}, false, "Suppress the verbose output generated by the containers")
84 84
 	noCache := cmd.Bool([]string{"#no-cache", "-no-cache"}, false, "Do not use cache when building the image")
85 85
 	rm := cmd.Bool([]string{"#rm", "-rm"}, true, "Remove intermediate containers after a successful build")
86
-	forceRm := cmd.Bool([]string{"-force-rm"}, false, "Always remove intermediate containers, even after unsuccessful builds")
86
+	forceRm := cmd.Bool([]string{"-force-rm"}, false, "Always remove intermediate containers")
87 87
 	pull := cmd.Bool([]string{"-pull"}, false, "Always attempt to pull a newer version of the image")
88
-	dockerfileName := cmd.String([]string{"f", "-file"}, "", "Name of the Dockerfile(Default is 'Dockerfile' at context root)")
88
+	dockerfileName := cmd.String([]string{"f", "-file"}, "", "Name of the Dockerfile(Default is 'Dockerfile')")
89 89
 
90 90
 	cmd.Require(flag.Exact, 1)
91 91
 
... ...
@@ -284,7 +284,7 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
284 284
 
285 285
 // 'docker login': login / register a user to registry service.
286 286
 func (cli *DockerCli) CmdLogin(args ...string) error {
287
-	cmd := cli.Subcmd("login", "[SERVER]", "Register or log in to a Docker registry server, if no server is specified \""+registry.IndexServerAddress()+"\" is the default.", true)
287
+	cmd := cli.Subcmd("login", "[SERVER]", "Register or log in to a Docker registry server, if no server is\nspecified \""+registry.IndexServerAddress()+"\" is the default.", true)
288 288
 	cmd.Require(flag.Max, 1)
289 289
 
290 290
 	var username, password, email string
... ...
@@ -400,7 +400,7 @@ func (cli *DockerCli) CmdLogin(args ...string) error {
400 400
 
401 401
 // log out from a Docker registry
402 402
 func (cli *DockerCli) CmdLogout(args ...string) error {
403
-	cmd := cli.Subcmd("logout", "[SERVER]", "Log out from a Docker registry, if no server is specified \""+registry.IndexServerAddress()+"\" is the default.", true)
403
+	cmd := cli.Subcmd("logout", "[SERVER]", "Log out from a Docker registry, if no server is\nspecified \""+registry.IndexServerAddress()+"\" is the default.", true)
404 404
 	cmd.Require(flag.Max, 1)
405 405
 
406 406
 	utils.ParseFlags(cmd, args, false)
... ...
@@ -601,8 +601,8 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
601 601
 }
602 602
 
603 603
 func (cli *DockerCli) CmdStop(args ...string) error {
604
-	cmd := cli.Subcmd("stop", "CONTAINER [CONTAINER...]", "Stop a running container by sending SIGTERM and then SIGKILL after a grace period", true)
605
-	nSeconds := cmd.Int([]string{"t", "-time"}, 10, "Number of seconds to wait for the container to stop before killing it. Default is 10 seconds.")
604
+	cmd := cli.Subcmd("stop", "CONTAINER [CONTAINER...]", "Stop a running container by sending SIGTERM and then SIGKILL after a\ngrace period", true)
605
+	nSeconds := cmd.Int([]string{"t", "-time"}, 10, "Seconds to wait for stop before killing it.")
606 606
 	cmd.Require(flag.Min, 1)
607 607
 
608 608
 	utils.ParseFlags(cmd, args, true)
... ...
@@ -625,7 +625,7 @@ func (cli *DockerCli) CmdStop(args ...string) error {
625 625
 
626 626
 func (cli *DockerCli) CmdRestart(args ...string) error {
627 627
 	cmd := cli.Subcmd("restart", "CONTAINER [CONTAINER...]", "Restart a running container", true)
628
-	nSeconds := cmd.Int([]string{"t", "-time"}, 10, "Number of seconds to try to stop for before killing the container. Once killed it will then be restarted. Default is 10 seconds.")
628
+	nSeconds := cmd.Int([]string{"t", "-time"}, 10, "Seconds to wait for stop before killing the container.")
629 629
 	cmd.Require(flag.Min, 1)
630 630
 
631 631
 	utils.ParseFlags(cmd, args, true)
... ...
@@ -678,7 +678,7 @@ func (cli *DockerCli) CmdStart(args ...string) error {
678 678
 		tty  bool
679 679
 
680 680
 		cmd       = cli.Subcmd("start", "CONTAINER [CONTAINER...]", "Restart a stopped container", true)
681
-		attach    = cmd.Bool([]string{"a", "-attach"}, false, "Attach container's STDOUT and STDERR and forward all signals to the process")
681
+		attach    = cmd.Bool([]string{"a", "-attach"}, false, "Attach STDOUT/STDERR and forward signals")
682 682
 		openStdin = cmd.Bool([]string{"i", "-interactive"}, false, "Attach container's STDIN")
683 683
 	)
684 684
 
... ...
@@ -947,7 +947,7 @@ func (cli *DockerCli) CmdTop(args ...string) error {
947 947
 }
948 948
 
949 949
 func (cli *DockerCli) CmdPort(args ...string) error {
950
-	cmd := cli.Subcmd("port", "CONTAINER [PRIVATE_PORT[/PROTO]]", "List port mappings for the CONTAINER, or lookup the public-facing port that is NAT-ed to the PRIVATE_PORT", true)
950
+	cmd := cli.Subcmd("port", "CONTAINER [PRIVATE_PORT[/PROTO]]", "List port mappings for the CONTAINER, or lookup the public-facing port that\nis NAT-ed to the PRIVATE_PORT", true)
951 951
 	cmd.Require(flag.Min, 1)
952 952
 	utils.ParseFlags(cmd, args, true)
953 953
 
... ...
@@ -1094,7 +1094,7 @@ func (cli *DockerCli) CmdHistory(args ...string) error {
1094 1094
 func (cli *DockerCli) CmdRm(args ...string) error {
1095 1095
 	cmd := cli.Subcmd("rm", "CONTAINER [CONTAINER...]", "Remove one or more containers", true)
1096 1096
 	v := cmd.Bool([]string{"v", "-volumes"}, false, "Remove the volumes associated with the container")
1097
-	link := cmd.Bool([]string{"l", "#link", "-link"}, false, "Remove the specified link and not the underlying container")
1097
+	link := cmd.Bool([]string{"l", "#link", "-link"}, false, "Remove the specified link")
1098 1098
 	force := cmd.Bool([]string{"f", "-force"}, false, "Force the removal of a running container (uses SIGKILL)")
1099 1099
 	cmd.Require(flag.Min, 1)
1100 1100
 
... ...
@@ -1146,7 +1146,7 @@ func (cli *DockerCli) CmdKill(args ...string) error {
1146 1146
 }
1147 1147
 
1148 1148
 func (cli *DockerCli) CmdImport(args ...string) error {
1149
-	cmd := cli.Subcmd("import", "URL|- [REPOSITORY[:TAG]]", "Create an empty filesystem image and import the contents of the tarball (.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz) into it, then optionally tag it.", true)
1149
+	cmd := cli.Subcmd("import", "URL|- [REPOSITORY[:TAG]]", "Create an empty filesystem image and import the contents of the\ntarball (.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz) into it, then\noptionally tag it.", true)
1150 1150
 	cmd.Require(flag.Min, 1)
1151 1151
 
1152 1152
 	utils.ParseFlags(cmd, args, true)
... ...
@@ -1309,7 +1309,7 @@ func (cli *DockerCli) CmdPull(args ...string) error {
1309 1309
 func (cli *DockerCli) CmdImages(args ...string) error {
1310 1310
 	cmd := cli.Subcmd("images", "[REPOSITORY]", "List images", true)
1311 1311
 	quiet := cmd.Bool([]string{"q", "-quiet"}, false, "Only show numeric IDs")
1312
-	all := cmd.Bool([]string{"a", "-all"}, false, "Show all images (by default filter out the intermediate image layers)")
1312
+	all := cmd.Bool([]string{"a", "-all"}, false, "Show all images (default hides intermediate images)")
1313 1313
 	noTrunc := cmd.Bool([]string{"#notrunc", "-no-trunc"}, false, "Don't truncate output")
1314 1314
 	// FIXME: --viz and --tree are deprecated. Remove them in a future version.
1315 1315
 	flViz := cmd.Bool([]string{"#v", "#viz", "#-viz"}, false, "Output graph in graphviz format")
... ...
@@ -1542,12 +1542,12 @@ func (cli *DockerCli) CmdPs(args ...string) error {
1542 1542
 		cmd      = cli.Subcmd("ps", "", "List containers", true)
1543 1543
 		quiet    = cmd.Bool([]string{"q", "-quiet"}, false, "Only display numeric IDs")
1544 1544
 		size     = cmd.Bool([]string{"s", "-size"}, false, "Display total file sizes")
1545
-		all      = cmd.Bool([]string{"a", "-all"}, false, "Show all containers. Only running containers are shown by default.")
1545
+		all      = cmd.Bool([]string{"a", "-all"}, false, "Show all containers (default shows just running)")
1546 1546
 		noTrunc  = cmd.Bool([]string{"#notrunc", "-no-trunc"}, false, "Don't truncate output")
1547
-		nLatest  = cmd.Bool([]string{"l", "-latest"}, false, "Show only the latest created container, include non-running ones.")
1548
-		since    = cmd.String([]string{"#sinceId", "#-since-id", "-since"}, "", "Show only containers created since Id or Name, include non-running ones.")
1549
-		before   = cmd.String([]string{"#beforeId", "#-before-id", "-before"}, "", "Show only container created before Id or Name, include non-running ones.")
1550
-		last     = cmd.Int([]string{"n"}, -1, "Show n last created containers, include non-running ones.")
1547
+		nLatest  = cmd.Bool([]string{"l", "-latest"}, false, "Show the latest created container, include non-running.")
1548
+		since    = cmd.String([]string{"#sinceId", "#-since-id", "-since"}, "", "Show created since Id or Name, include non-running.")
1549
+		before   = cmd.String([]string{"#beforeId", "#-before-id", "-before"}, "", "Show only container created before Id or Name.")
1550
+		last     = cmd.Int([]string{"n"}, -1, "Show n last created containers, include non-running.")
1551 1551
 		flFilter = opts.NewListOpts(nil)
1552 1552
 	)
1553 1553
 	cmd.Require(flag.Exact, 0)
... ...
@@ -1847,7 +1847,7 @@ func (cli *DockerCli) CmdLogs(args ...string) error {
1847 1847
 		cmd    = cli.Subcmd("logs", "CONTAINER", "Fetch the logs of a container", true)
1848 1848
 		follow = cmd.Bool([]string{"f", "-follow"}, false, "Follow log output")
1849 1849
 		times  = cmd.Bool([]string{"t", "-timestamps"}, false, "Show timestamps")
1850
-		tail   = cmd.String([]string{"-tail"}, "all", "Output the specified number of lines at the end of logs (defaults to all logs)")
1850
+		tail   = cmd.String([]string{"-tail"}, "all", "Number of lines to show from the end of the logs")
1851 1851
 	)
1852 1852
 	cmd.Require(flag.Exact, 1)
1853 1853
 
... ...
@@ -1885,7 +1885,7 @@ func (cli *DockerCli) CmdAttach(args ...string) error {
1885 1885
 	var (
1886 1886
 		cmd     = cli.Subcmd("attach", "CONTAINER", "Attach to a running container", true)
1887 1887
 		noStdin = cmd.Bool([]string{"#nostdin", "-no-stdin"}, false, "Do not attach STDIN")
1888
-		proxy   = cmd.Bool([]string{"#sig-proxy", "-sig-proxy"}, true, "Proxy all received signals to the process (non-TTY mode only). SIGCHLD, SIGKILL, and SIGSTOP are not proxied.")
1888
+		proxy   = cmd.Bool([]string{"#sig-proxy", "-sig-proxy"}, true, "Proxy all received signals to the process")
1889 1889
 	)
1890 1890
 	cmd.Require(flag.Exact, 1)
1891 1891
 
... ...
@@ -2202,9 +2202,9 @@ func (cli *DockerCli) CmdRun(args ...string) error {
2202 2202
 
2203 2203
 	// These are flags not stored in Config/HostConfig
2204 2204
 	var (
2205
-		flAutoRemove = cmd.Bool([]string{"#rm", "-rm"}, false, "Automatically remove the container when it exits (incompatible with -d)")
2206
-		flDetach     = cmd.Bool([]string{"d", "-detach"}, false, "Detached mode: run the container in the background and print the new container ID")
2207
-		flSigProxy   = cmd.Bool([]string{"#sig-proxy", "-sig-proxy"}, true, "Proxy received signals to the process (non-TTY mode only). SIGCHLD, SIGSTOP, and SIGKILL are not proxied.")
2205
+		flAutoRemove = cmd.Bool([]string{"#rm", "-rm"}, false, "Automatically remove the container when it exits")
2206
+		flDetach     = cmd.Bool([]string{"d", "-detach"}, false, "Run container in background and print container ID")
2207
+		flSigProxy   = cmd.Bool([]string{"#sig-proxy", "-sig-proxy"}, true, "Proxy received signals to the process")
2208 2208
 		flName       = cmd.String([]string{"#name", "-name"}, "", "Assign a name to the container")
2209 2209
 		flAttach     *opts.ListOpts
2210 2210
 
... ...
@@ -2728,7 +2728,7 @@ func (cli *DockerCli) CmdStats(args ...string) error {
2728 2728
 	if len(errs) > 0 {
2729 2729
 		return fmt.Errorf("%s", strings.Join(errs, ", "))
2730 2730
 	}
2731
-	for _ = range time.Tick(500 * time.Millisecond) {
2731
+	for range time.Tick(500 * time.Millisecond) {
2732 2732
 		printHeader()
2733 2733
 		toRemove := []int{}
2734 2734
 		for i, s := range cStats {
... ...
@@ -50,27 +50,27 @@ type Config struct {
50 50
 // from the command-line.
51 51
 func (config *Config) InstallFlags() {
52 52
 	flag.StringVar(&config.Pidfile, []string{"p", "-pidfile"}, "/var/run/docker.pid", "Path to use for daemon PID file")
53
-	flag.StringVar(&config.Root, []string{"g", "-graph"}, "/var/lib/docker", "Path to use as the root of the Docker runtime")
53
+	flag.StringVar(&config.Root, []string{"g", "-graph"}, "/var/lib/docker", "Root of the Docker runtime")
54 54
 	flag.BoolVar(&config.AutoRestart, []string{"#r", "#-restart"}, true, "--restart on the daemon has been deprecated in favor of --restart policies on docker run")
55
-	flag.BoolVar(&config.EnableIptables, []string{"#iptables", "-iptables"}, true, "Enable Docker's addition of iptables rules")
56
-	flag.BoolVar(&config.EnableIpForward, []string{"#ip-forward", "-ip-forward"}, true, "Enable net.ipv4.ip_forward and IPv6 forwarding if --fixed-cidr-v6 is defined. IPv6 forwarding may interfere with your existing IPv6 configuration when using Router Advertisement.")
57
-	flag.BoolVar(&config.EnableIpMasq, []string{"-ip-masq"}, true, "Enable IP masquerading for bridge's IP range")
55
+	flag.BoolVar(&config.EnableIptables, []string{"#iptables", "-iptables"}, true, "Enable addition of iptables rules")
56
+	flag.BoolVar(&config.EnableIpForward, []string{"#ip-forward", "-ip-forward"}, true, "Enable net.ipv4.ip_forward")
57
+	flag.BoolVar(&config.EnableIpMasq, []string{"-ip-masq"}, true, "Enable IP masquerading")
58 58
 	flag.BoolVar(&config.EnableIPv6, []string{"-ipv6"}, false, "Enable IPv6 networking")
59
-	flag.StringVar(&config.BridgeIP, []string{"#bip", "-bip"}, "", "Use this CIDR notation address for the network bridge's IP, not compatible with -b")
60
-	flag.StringVar(&config.BridgeIface, []string{"b", "-bridge"}, "", "Attach containers to a pre-existing network bridge\nuse 'none' to disable container networking")
61
-	flag.StringVar(&config.FixedCIDR, []string{"-fixed-cidr"}, "", "IPv4 subnet for fixed IPs (e.g. 10.20.0.0/16)\nthis subnet must be nested in the bridge subnet (which is defined by -b or --bip)")
62
-	flag.StringVar(&config.FixedCIDRv6, []string{"-fixed-cidr-v6"}, "", "IPv6 subnet for fixed IPs (e.g.: 2001:a02b/48)")
63
-	flag.BoolVar(&config.InterContainerCommunication, []string{"#icc", "-icc"}, true, "Allow unrestricted inter-container and Docker daemon host communication")
64
-	flag.StringVar(&config.GraphDriver, []string{"s", "-storage-driver"}, "", "Force the Docker runtime to use a specific storage driver")
65
-	flag.StringVar(&config.ExecDriver, []string{"e", "-exec-driver"}, "native", "Force the Docker runtime to use a specific exec driver")
66
-	flag.BoolVar(&config.EnableSelinuxSupport, []string{"-selinux-enabled"}, false, "Enable selinux support. SELinux does not presently support the BTRFS storage driver")
67
-	flag.IntVar(&config.Mtu, []string{"#mtu", "-mtu"}, 0, "Set the containers network MTU\nif no value is provided: default to the default route MTU or 1500 if no default route is available")
68
-	opts.IPVar(&config.DefaultIp, []string{"#ip", "-ip"}, "0.0.0.0", "Default IP address to use when binding container ports")
59
+	flag.StringVar(&config.BridgeIP, []string{"#bip", "-bip"}, "", "Specify network bridge IP")
60
+	flag.StringVar(&config.BridgeIface, []string{"b", "-bridge"}, "", "Attach containers to a network bridge")
61
+	flag.StringVar(&config.FixedCIDR, []string{"-fixed-cidr"}, "", "IPv4 subnet for fixed IPs")
62
+	flag.StringVar(&config.FixedCIDRv6, []string{"-fixed-cidr-v6"}, "", "IPv6 subnet for fixed IPs")
63
+	flag.BoolVar(&config.InterContainerCommunication, []string{"#icc", "-icc"}, true, "Enable inter-container communication")
64
+	flag.StringVar(&config.GraphDriver, []string{"s", "-storage-driver"}, "", "Storage driver to use")
65
+	flag.StringVar(&config.ExecDriver, []string{"e", "-exec-driver"}, "native", "Exec driver to use")
66
+	flag.BoolVar(&config.EnableSelinuxSupport, []string{"-selinux-enabled"}, false, "Enable selinux support")
67
+	flag.IntVar(&config.Mtu, []string{"#mtu", "-mtu"}, 0, "Set the containers network MTU")
68
+	opts.IPVar(&config.DefaultIp, []string{"#ip", "-ip"}, "0.0.0.0", "Default IP when binding container ports")
69 69
 	opts.ListVar(&config.GraphOptions, []string{"-storage-opt"}, "Set storage driver options")
70 70
 	// FIXME: why the inconsistency between "hosts" and "sockets"?
71
-	opts.IPListVar(&config.Dns, []string{"#dns", "-dns"}, "Force Docker to use specific DNS servers")
72
-	opts.DnsSearchListVar(&config.DnsSearch, []string{"-dns-search"}, "Force Docker to use specific DNS search domains")
73
-	opts.LabelListVar(&config.Labels, []string{"-label"}, "Set key=value labels to the daemon (displayed in `docker info`)")
71
+	opts.IPListVar(&config.Dns, []string{"#dns", "-dns"}, "DNS server to use")
72
+	opts.DnsSearchListVar(&config.DnsSearch, []string{"-dns-search"}, "DNS search domains to use")
73
+	opts.LabelListVar(&config.Labels, []string{"-label"}, "Set key=value labels to the daemon")
74 74
 }
75 75
 
76 76
 func getDefaultNetworkMtu() int {
... ...
@@ -40,12 +40,12 @@ var (
40 40
 	flVersion     = flag.Bool([]string{"v", "-version"}, false, "Print version information and quit")
41 41
 	flDaemon      = flag.Bool([]string{"d", "-daemon"}, false, "Enable daemon mode")
42 42
 	flDebug       = flag.Bool([]string{"D", "-debug"}, false, "Enable debug mode")
43
-	flSocketGroup = flag.String([]string{"G", "-group"}, "docker", "Group to assign the unix socket specified by -H when running in daemon mode\nuse '' (the empty string) to disable setting of a group")
44
-	flLogLevel    = flag.String([]string{"l", "-log-level"}, "info", "Set the logging level (debug, info, warn, error, fatal)")
43
+	flSocketGroup = flag.String([]string{"G", "-group"}, "docker", "Group for the unix socket")
44
+	flLogLevel    = flag.String([]string{"l", "-log-level"}, "info", "Set the logging level")
45 45
 	flEnableCors  = flag.Bool([]string{"#api-enable-cors", "-api-enable-cors"}, false, "Enable CORS headers in the remote API")
46 46
 	flTls         = flag.Bool([]string{"-tls"}, false, "Use TLS; implied by --tlsverify flag")
47 47
 	flHelp        = flag.Bool([]string{"h", "-help"}, false, "Print usage")
48
-	flTlsVerify   = flag.Bool([]string{"-tlsverify"}, dockerTlsVerify, "Use TLS and verify the remote (daemon: verify client, client: verify daemon)")
48
+	flTlsVerify   = flag.Bool([]string{"-tlsverify"}, dockerTlsVerify, "Use TLS and verify the remote")
49 49
 
50 50
 	// these are initialized in init() below since their default values depend on dockerCertPath which isn't fully initialized until init() runs
51 51
 	flTrustKey *string
... ...
@@ -70,10 +70,10 @@ func init() {
70 70
 	// TODO use flag flag.String([]string{"i", "-identity"}, "", "Path to libtrust key file")
71 71
 	flTrustKey = &placeholderTrustKey
72 72
 
73
-	flCa = flag.String([]string{"-tlscacert"}, filepath.Join(dockerCertPath, defaultCaFile), "Trust only remotes providing a certificate signed by the CA given here")
73
+	flCa = flag.String([]string{"-tlscacert"}, filepath.Join(dockerCertPath, defaultCaFile), "Trust certs signed only by this CA")
74 74
 	flCert = flag.String([]string{"-tlscert"}, filepath.Join(dockerCertPath, defaultCertFile), "Path to TLS certificate file")
75 75
 	flKey = flag.String([]string{"-tlskey"}, filepath.Join(dockerCertPath, defaultKeyFile), "Path to TLS key file")
76
-	opts.HostListVar(&flHosts, []string{"H", "-host"}, "The socket(s) to bind to in daemon mode or connect to in client mode, specified using one or more tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd.")
76
+	opts.HostListVar(&flHosts, []string{"H", "-host"}, "Daemon socket(s) to use or connect to")
77 77
 
78 78
 	flag.Usage = func() {
79 79
 		fmt.Fprint(os.Stdout, "Usage: docker [OPTIONS] COMMAND [arg...]\n\nA self-sufficient runtime for linux containers.\n\nOptions:\n")
... ...
@@ -116,7 +116,7 @@ func init() {
116 116
 			{"save", "Save an image to a tar archive"},
117 117
 			{"search", "Search for an image on the Docker Hub"},
118 118
 			{"start", "Start a stopped container"},
119
-			{"stats", "Display a live stream of one or more containers' resource usage statistics"},
119
+			{"stats", "Display a stream of a containers' resource usage statistics"},
120 120
 			{"stop", "Stop a running container"},
121 121
 			{"tag", "Tag an image into a repository"},
122 122
 			{"top", "Lookup the running processes of a container"},
... ...
@@ -70,42 +70,38 @@ expect an integer, and they can only be specified once.
70 70
 
71 71
     Options:
72 72
       --api-enable-cors=false                    Enable CORS headers in the remote API
73
-      -b, --bridge=""                            Attach containers to a pre-existing network bridge
74
-                                                   use 'none' to disable container networking
75
-      --bip=""                                   Use this CIDR notation address for the network bridge's IP, not compatible with -b
73
+      -b, --bridge=""                            Attach containers to a network bridge
74
+      --bip=""                                   Specify network bridge IP
76 75
       -D, --debug=false                          Enable debug mode
77 76
       -d, --daemon=false                         Enable daemon mode
78
-      --dns=[]                                   Force Docker to use specific DNS servers
79
-      --dns-search=[]                            Force Docker to use specific DNS search domains
80
-      -e, --exec-driver="native"                 Force the Docker runtime to use a specific exec driver
81
-      --fixed-cidr=""                            IPv4 subnet for fixed IPs (e.g.: 10.20.0.0/16)
82
-                                                   this subnet must be nested in the bridge subnet (which is defined by -b or --bip)
83
-      --fixed-cidr-v6=""                         IPv6 subnet for global IPs (e.g.: 2a00:1450::/64)
84
-      -G, --group="docker"                       Group to assign the unix socket specified by -H when running in daemon mode
85
-                                                   use '' (the empty string) to disable setting of a group
86
-      -g, --graph="/var/lib/docker"              Path to use as the root of the Docker runtime
87
-      -H, --host=[]                              The socket(s) to bind to in daemon mode or connect to in client mode, specified using one or more tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd.
88
-      --icc=true                                 Allow unrestricted inter-container and Docker daemon host communication
89
-      --insecure-registry=[]                     Enable insecure communication with specified registries (disables certificate verification for HTTPS and enables HTTP fallback) (e.g., localhost:5000 or 10.20.0.0/16)
90
-      --ip=0.0.0.0                               Default IP address to use when binding container ports
91
-      --ip-forward=true                          Enable net.ipv4.ip_forward and IPv6 forwarding if --fixed-cidr-v6 is defined. IPv6 forwarding may interfere with your existing IPv6 configuration when using Router Advertisement.
92
-      --ip-masq=true                             Enable IP masquerading for bridge's IP range
93
-      --iptables=true                            Enable Docker's addition of iptables rules
94
-      --ipv6=false                               Enable Docker IPv6 support
95
-       -l, --log-level="info"                    Set the logging level (debug, info, warn, error, fatal)
96
-      --label=[]                                 Set key=value labels to the daemon (displayed in `docker info`)
77
+      --dns=[]                                   DNS server to use
78
+      --dns-search=[]                            DNS search domains to use
79
+      -e, --exec-driver="native"                 Exec driver to use
80
+      --fixed-cidr=""                            IPv4 subnet for fixed IPs
81
+      --fixed-cidr-v6=""                         IPv6 subnet for fixed IPs
82
+      -G, --group="docker"                       Group for the unix socket
83
+      -g, --graph="/var/lib/docker"              Root of the Docker runtime
84
+      -H, --host=[]                              Daemon socket(s) to use or connect to
85
+      --icc=true                                 Enable inter-container communication
86
+      --insecure-registry=[]                     Enable insecure registry communication
87
+      --ip=0.0.0.0                               Default IP when binding container ports
88
+      --ip-forward=true                          Enable net.ipv4.ip_forward
89
+      --ip-masq=true                             Enable IP masquerading
90
+      --iptables=true                            Enable addition of iptables rules
91
+      --ipv6=false                               Enable IPv6 networking
92
+       -l, --log-level="info"                    Set the logging level
93
+      --label=[]                                 Set key=value labels to the daemon
97 94
       --mtu=0                                    Set the containers network MTU
98
-                                                   if no value is provided: default to the default route MTU or 1500 if no default route is available
99 95
       -p, --pidfile="/var/run/docker.pid"        Path to use for daemon PID file
100
-      --registry-mirror=[]                       Specify a preferred Docker registry mirror
101
-      -s, --storage-driver=""                    Force the Docker runtime to use a specific storage driver
102
-      --selinux-enabled=false                    Enable selinux support. SELinux does not presently support the BTRFS storage driver
96
+      --registry-mirror=[]                       Preferred Docker registry mirror
97
+      -s, --storage-driver=""                    Storage driver to use
98
+      --selinux-enabled=false                    Enable selinux support
103 99
       --storage-opt=[]                           Set storage driver options
104 100
       --tls=false                                Use TLS; implied by --tlsverify flag
105
-      --tlscacert="/home/sven/.docker/ca.pem"    Trust only remotes providing a certificate signed by the CA given here
101
+      --tlscacert="/home/sven/.docker/ca.pem"    Trust certs signed only by this CA
106 102
       --tlscert="/home/sven/.docker/cert.pem"    Path to TLS certificate file
107 103
       --tlskey="/home/sven/.docker/key.pem"      Path to TLS key file
108
-      --tlsverify=false                          Use TLS and verify the remote (daemon: verify client, client: verify daemon)
104
+      --tlsverify=false                          Use TLS and verify the remote
109 105
       -v, --version=false                        Print version information and quit
110 106
 
111 107
 Options with [] may be specified multiple times.
... ...
@@ -428,7 +424,7 @@ Docker supports softlinks for the Docker data directory
428 428
     Attach to a running container
429 429
 
430 430
       --no-stdin=false    Do not attach STDIN
431
-      --sig-proxy=true    Proxy all received signals to the process (non-TTY mode only). SIGCHLD, SIGKILL, and SIGSTOP are not proxied.
431
+      --sig-proxy=true    Proxy all received signals to the process
432 432
 
433 433
 The `attach` command lets you view or interact with any running container's
434 434
 primary process (`pid 1`).
... ...
@@ -489,12 +485,13 @@ To kill the container, use `docker kill`.
489 489
 
490 490
     Build a new image from the source code at PATH
491 491
 
492
-      --force-rm=false         Always remove intermediate containers, even after unsuccessful builds
492
+      -f, --file=""            Name of the Dockerfile(Default is 'Dockerfile')
493
+      --force-rm=false         Always remove intermediate containers
493 494
       --no-cache=false         Do not use cache when building the image
494 495
       --pull=false             Always attempt to pull a newer version of the image
495 496
       -q, --quiet=false        Suppress the verbose output generated by the containers
496 497
       --rm=true                Remove intermediate containers after a successful build
497
-      -t, --tag=""             Repository name (and optionally a tag) to be applied to the resulting image in case of success
498
+      -t, --tag=""             Repository name (and optionally a tag) for the image
498 499
 
499 500
 Use this command to build Docker images from a Dockerfile and a
500 501
 "context".
... ...
@@ -734,41 +731,31 @@ Creates a new container.
734 734
       --cap-drop=[]              Drop Linux capabilities
735 735
       --cidfile=""               Write the container ID to the file
736 736
       --cpuset=""                CPUs in which to allow execution (0-3, 0,1)
737
-      --device=[]                Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc:rwm)
737
+      --device=[]                Add a host device to the container
738 738
       --dns=[]                   Set custom DNS servers
739
-      --dns-search=[]            Set custom DNS search domains (Use --dns-search=. if you don't wish to set the search domain)
739
+      --dns-search=[]            Set custom DNS search domains
740 740
       -e, --env=[]               Set environment variables
741 741
       --entrypoint=""            Overwrite the default ENTRYPOINT of the image
742
-      --env-file=[]              Read in a line delimited file of environment variables
743
-      --expose=[]                Expose a port or a range of ports (e.g. --expose=3300-3310) from the container without publishing it to your host
742
+      --env-file=[]              Read in a file of environment variables
743
+      --expose=[]                Expose a port or a range of ports
744 744
       -h, --hostname=""          Container host name
745 745
       -i, --interactive=false    Keep STDIN open even if not attached
746
-      --ipc=""                   Default is to create a private IPC namespace (POSIX SysV IPC) for the container
747
-                                   'container:<name|id>': reuses another container shared memory, semaphores and message queues
748
-                                   'host': use the host shared memory,semaphores and message queues inside the container.  Note: the host mode gives the container full access to local shared memory and is therefore considered insecure.
749
-      --link=[]                  Add link to another container in the form of <name or id>:alias
750
-      --lxc-conf=[]              (lxc exec-driver only) Add custom lxc options --lxc-conf="lxc.cgroup.cpuset.cpus = 0,1"
751
-      -m, --memory=""            Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
746
+      --ipc=""                   IPC namespace to use
747
+      --link=[]                  Add link to another container
748
+      --lxc-conf=[]              Add custom lxc options
749
+      -m, --memory=""            Memory limit
752 750
       --mac-address=""           Container MAC address (e.g. 92:d0:c6:0a:29:33)
753 751
       --name=""                  Assign a name to the container
754 752
       --net="bridge"             Set the Network mode for the container
755
-                                   'bridge': creates a new network stack for the container on the docker bridge
756
-                                   'none': no networking for this container
757
-                                   'container:<name|id>': reuses another container network stack
758
-                                   'host': use the host network stack inside the container.  Note: the host mode gives the container full access to local system services such as D-bus and is therefore considered insecure.
759
-      -P, --publish-all=false    Publish all exposed ports to random ports on the host interfaces
760
-      -p, --publish=[]           Publish a container's port, or a range of ports (e.g., `-p 3300-3310`), to the host
761
-                                   format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort
762
-                                   Both hostPort and containerPort can be specified as a range of ports. 
763
-                                   When specifying ranges for both, the number of container ports in the range must match the number of host ports in the range. (e.g., `-p 1234-1236:1234-1236/tcp`)
764
-                                   (use 'docker port' to see the actual mapping)
753
+      -P, --publish-all=false    Publish all exposed ports to random ports
754
+      -p, --publish=[]           Publish a container's port(s) to the host
765 755
       --privileged=false         Give extended privileges to this container
766
-      --read-only=false           Mount the container's root filesystem as read only
767
-      --restart=""               Restart policy to apply when a container exits (no, on-failure[:max-retry], always)
756
+      --read-only=false          Mount the container's root filesystem as read only
757
+      --restart=""               Restart policy to apply when a container exits
768 758
       --security-opt=[]          Security Options
769 759
       -t, --tty=false            Allocate a pseudo-TTY
770 760
       -u, --user=""              Username or UID
771
-      -v, --volume=[]            Bind mount a volume (e.g., from the host: -v /host:/container, from Docker: -v /container)
761
+      -v, --volume=[]            Bind mount a volume
772 762
       --volumes-from=[]          Mount volumes from the specified container(s)
773 763
       -w, --workdir=""           Working directory inside the container
774 764
 
... ...
@@ -1043,7 +1030,7 @@ To see how the `docker:latest` image was built:
1043 1043
 
1044 1044
     List images
1045 1045
 
1046
-      -a, --all=false      Show all images (by default filter out the intermediate image layers)
1046
+      -a, --all=false      Show all images (default hides intermediate images)
1047 1047
       -f, --filter=[]      Provide filter values (i.e., 'dangling=true')
1048 1048
       --no-trunc=false     Don't truncate output
1049 1049
       -q, --quiet=false    Only show numeric IDs
... ...
@@ -1136,7 +1123,9 @@ NOTE: Docker will warn you if any containers exist that are using these untagged
1136 1136
 
1137 1137
     Usage: docker import URL|- [REPOSITORY[:TAG]]
1138 1138
 
1139
-    Create an empty filesystem image and import the contents of the tarball (.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz) into it, then optionally tag it.
1139
+    Create an empty filesystem image and import the contents of the
1140
+	tarball (.tar, .tar.gz, .tgz, .bzip, .tar.xz, .txz) into it, then
1141
+	optionally tag it.
1140 1142
 
1141 1143
 URLs must start with `http` and point to a single file archive (.tar,
1142 1144
 .tar.gz, .tgz, .bzip, .tar.xz, or .txz) containing a root filesystem. If
... ...
@@ -1305,7 +1294,8 @@ Restores both images and tags.
1305 1305
 
1306 1306
     Usage: docker login [OPTIONS] [SERVER]
1307 1307
 
1308
-    Register or log in to a Docker registry server, if no server is specified "https://index.docker.io/v1/" is the default.
1308
+    Register or log in to a Docker registry server, if no server is
1309
+	specified "https://index.docker.io/v1/" is the default.
1309 1310
 
1310 1311
       -e, --email=""       Email
1311 1312
       -p, --password=""    Password
... ...
@@ -1321,7 +1311,8 @@ adding the server name.
1321 1321
 
1322 1322
     Usage: docker logout [SERVER]
1323 1323
 
1324
-    Log out from a Docker registry, if no server is specified "https://index.docker.io/v1/" is the default.
1324
+    Log out from a Docker registry, if no server is
1325
+	specified "https://index.docker.io/v1/" is the default.
1325 1326
 
1326 1327
 For example:
1327 1328
 
... ...
@@ -1335,7 +1326,7 @@ For example:
1335 1335
 
1336 1336
       -f, --follow=false        Follow log output
1337 1337
       -t, --timestamps=false    Show timestamps
1338
-      --tail="all"              Output the specified number of lines at the end of logs (defaults to all logs)
1338
+      --tail="all"              Number of lines to show from the end of the logs
1339 1339
 
1340 1340
 The `docker logs` command batch-retrieves logs present at the time of execution.
1341 1341
 
... ...
@@ -1370,7 +1361,8 @@ for further details.
1370 1370
 
1371 1371
     Usage: docker port CONTAINER [PRIVATE_PORT[/PROTO]]
1372 1372
 
1373
-    List port mappings for the CONTAINER, or lookup the public-facing port that is NAT-ed to the PRIVATE_PORT
1373
+    List port mappings for the CONTAINER, or lookup the public-facing port that is
1374
+	NAT-ed to the PRIVATE_PORT
1374 1375
 
1375 1376
 You can find out all the ports mapped by not specifying a `PRIVATE_PORT`, or
1376 1377
 just a specific mapping:
... ...
@@ -1418,17 +1410,17 @@ The `docker rename` command allows the container to be renamed to a different na
1418 1418
 
1419 1419
     List containers
1420 1420
 
1421
-      -a, --all=false       Show all containers. Only running containers are shown by default.
1422
-      --before=""           Show only container created before Id or Name, include non-running ones.
1421
+      -a, --all=false       Show all containers (default shows just running)
1422
+      --before=""           Show only container created before Id or Name.
1423 1423
       -f, --filter=[]       Provide filter values. Valid filters:
1424 1424
                               exited=<int> - containers with exit code of <int>
1425 1425
                               status=(restarting|running|paused|exited)
1426
-      -l, --latest=false    Show only the latest created container, include non-running ones.
1427
-      -n=-1                 Show n last created containers, include non-running ones.
1426
+      -l, --latest=false    Show the latest created container, include non-running.
1427
+      -n=-1                 Show n last created containers, include non-running .
1428 1428
       --no-trunc=false      Don't truncate output
1429 1429
       -q, --quiet=false     Only display numeric IDs
1430 1430
       -s, --size=false      Display total file sizes
1431
-      --since=""            Show only containers created since Id or Name, include non-running ones.
1431
+      --since=""            Show created since Id or Name, include non-running.
1432 1432
 
1433 1433
 Running `docker ps` showing 2 linked containers.
1434 1434
 
... ...
@@ -1510,7 +1502,7 @@ registry or to a self-hosted one.
1510 1510
 
1511 1511
     Restart a running container
1512 1512
 
1513
-      -t, --time=10      Number of seconds to try to stop for before killing the container. Once killed it will then be restarted. Default is 10 seconds.
1513
+      -t, --time=10      Seconds to wait for stop before killing the container.
1514 1514
 
1515 1515
 ## rm
1516 1516
 
... ...
@@ -1519,7 +1511,7 @@ registry or to a self-hosted one.
1519 1519
     Remove one or more containers
1520 1520
 
1521 1521
       -f, --force=false      Force the removal of a running container (uses SIGKILL)
1522
-      -l, --link=false       Remove the specified link and not the underlying container
1522
+      -l, --link=false       Remove the specified link
1523 1523
       -v, --volumes=false    Remove the volumes associated with the container
1524 1524
 
1525 1525
 #### Examples
... ...
@@ -1597,7 +1589,7 @@ removed before the image is removed.
1597 1597
       --cap-drop=[]              Drop Linux capabilities
1598 1598
       --cidfile=""               Write the container ID to the file
1599 1599
       --cpuset=""                CPUs in which to allow execution (0-3, 0,1)
1600
-      -d, --detach=false         Detached mode: run the container in the background and print the new container ID
1600
+      -d, --detach=false         Run container in background and print container ID
1601 1601
       --device=[]                Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc:rwm)
1602 1602
       --dns=[]                   Set custom DNS servers
1603 1603
       --dns-search=[]            Set custom DNS search domains (Use --dns-search=. if you don't wish to set the search domain)
... ...
@@ -1611,9 +1603,9 @@ removed before the image is removed.
1611 1611
                                    'container:<name|id>': reuses another container shared memory, semaphores and message queues
1612 1612
                                    'host': use the host shared memory,semaphores and message queues inside the container.  Note: the host mode gives the container full access to local shared memory and is therefore considered insecure.
1613 1613
       --link=[]                  Add link to another container in the form of name:alias
1614
-      --lxc-conf=[]              (lxc exec-driver only) Add custom lxc options --lxc-conf="lxc.cgroup.cpuset.cpus = 0,1"
1615
-      -m, --memory=""            Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
1616
-      -memory-swap=""            Total memory usage (memory + swap), set '-1' to disable swap (format: <number><optional unit>, where unit = b, k, m or g)
1614
+      --lxc-conf=[]              Add custom lxc options
1615
+      -m, --memory=""            Memory limit
1616
+      -memory-swap=""            Total memory (memory+swap), '-1' to disable swap
1617 1617
       --mac-address=""           Container MAC address (e.g. 92:d0:c6:0a:29:33)
1618 1618
       --name=""                  Assign a name to the container
1619 1619
       --net="bridge"             Set the Network mode for the container
... ...
@@ -1631,9 +1623,9 @@ removed before the image is removed.
1631 1631
       --privileged=false         Give extended privileges to this container
1632 1632
       --read-only=false           Mount the container's root filesystem as read only
1633 1633
       --restart=""               Restart policy to apply when a container exits (no, on-failure[:max-retry], always)
1634
-      --rm=false                 Automatically remove the container when it exits (incompatible with -d)
1634
+      --rm=false                 Automatically remove the container when it exits
1635 1635
       --security-opt=[]          Security Options
1636
-      --sig-proxy=true           Proxy received signals to the process (non-TTY mode only). SIGCHLD, SIGSTOP, and SIGKILL are not proxied.
1636
+      --sig-proxy=true           Proxy received signals to the process
1637 1637
       -t, --tty=false            Allocate a pseudo-TTY
1638 1638
       -u, --user=""              Username or UID
1639 1639
       -v, --volume=[]            Bind mount a volume (e.g., from the host: -v /host:/container, from Docker: -v /container)
... ...
@@ -2001,7 +1993,7 @@ more details on finding shared images from the command line.
2001 2001
 
2002 2002
     Restart a stopped container
2003 2003
 
2004
-      -a, --attach=false         Attach container's STDOUT and STDERR and forward all signals to the process
2004
+      -a, --attach=false         Attach STDOUT/STDERR and forward signals
2005 2005
       -i, --interactive=false    Attach container's STDIN
2006 2006
 
2007 2007
 ## stats
... ...
@@ -2030,9 +2022,10 @@ containers. Stopped containers will not return any data.
2030 2030
 
2031 2031
     Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...]
2032 2032
 
2033
-    Stop a running container by sending SIGTERM and then SIGKILL after a grace period
2033
+    Stop a running container by sending SIGTERM and then SIGKILL after a
2034
+	grace period
2034 2035
 
2035
-      -t, --time=10      Number of seconds to wait for the container to stop before killing it. Default is 10 seconds.
2036
+      -t, --time=10      Seconds to wait for stop before killing it.
2036 2037
 
2037 2038
 The main process inside the container will receive `SIGTERM`, and after a
2038 2039
 grace period, `SIGKILL`.
... ...
@@ -341,7 +341,7 @@ milliseconds.
341 341
     --cap-drop: Drop Linux capabilities
342 342
     --privileged=false: Give extended privileges to this container
343 343
     --device=[]: Allows you to run devices inside the container without the --privileged flag.
344
-    --lxc-conf=[]: (lxc exec-driver only) Add custom lxc options --lxc-conf="lxc.cgroup.cpuset.cpus = 0,1"
344
+    --lxc-conf=[]: Add custom lxc options
345 345
 
346 346
 By default, Docker containers are "unprivileged" and cannot, for
347 347
 example, run a Docker daemon inside a Docker container. This is because
348 348
new file mode 100644
... ...
@@ -0,0 +1,104 @@
0
+package main
1
+
2
+import (
3
+	"os"
4
+	"os/exec"
5
+	"runtime"
6
+	"strings"
7
+	"testing"
8
+)
9
+
10
+func TestMainHelpWidth(t *testing.T) {
11
+	// Make sure main help text fits within 80 chars and that
12
+	// on non-windows system we use ~ when possible (to shorten things)
13
+
14
+	var home string
15
+	if runtime.GOOS != "windows" {
16
+		home = os.Getenv("HOME")
17
+	}
18
+
19
+	helpCmd := exec.Command(dockerBinary, "help")
20
+	out, ec, err := runCommandWithOutput(helpCmd)
21
+	if err != nil || ec != 0 {
22
+		t.Fatalf("docker help should have worked\nout:%s\nec:%d", out, ec)
23
+	}
24
+	lines := strings.Split(out, "\n")
25
+	for _, line := range lines {
26
+		if len(line) > 80 {
27
+			t.Fatalf("Line is too long(%d chars):\n%s", len(line), line)
28
+		}
29
+		if home != "" && strings.Contains(line, home) {
30
+			t.Fatalf("Line should use ~ instead of %q:\n%s", home, line)
31
+		}
32
+	}
33
+	logDone("help - verify main width")
34
+}
35
+
36
+func TestCmdHelpWidth(t *testing.T) {
37
+	// Make sure main help text fits within 80 chars and that
38
+	// on non-windows system we use ~ when possible (to shorten things)
39
+
40
+	var home string
41
+	if runtime.GOOS != "windows" {
42
+		home = os.Getenv("HOME")
43
+	}
44
+
45
+	for _, command := range []string{
46
+		"attach",
47
+		"build",
48
+		"commit",
49
+		"cp",
50
+		"create",
51
+		"diff",
52
+		"events",
53
+		"exec",
54
+		"export",
55
+		"history",
56
+		"images",
57
+		"import",
58
+		"info",
59
+		"inspect",
60
+		"kill",
61
+		"load",
62
+		"login",
63
+		"logout",
64
+		"logs",
65
+		"port",
66
+		"pause",
67
+		"ps",
68
+		"pull",
69
+		"push",
70
+		"rename",
71
+		"restart",
72
+		"rm",
73
+		"rmi",
74
+		"run",
75
+		"save",
76
+		"search",
77
+		"start",
78
+		"stats",
79
+		"stop",
80
+		"tag",
81
+		"top",
82
+		"unpause",
83
+		"version",
84
+		"wait",
85
+	} {
86
+		helpCmd := exec.Command(dockerBinary, command, "--help")
87
+		out, ec, err := runCommandWithOutput(helpCmd)
88
+		if err != nil || ec != 0 {
89
+			t.Fatalf("docker help should have worked\nout:%s\nec:%d", out, ec)
90
+		}
91
+		lines := strings.Split(out, "\n")
92
+		for _, line := range lines {
93
+			if len(line) > 80 {
94
+				t.Fatalf("Help for %q is too long(%d chars):\n%s", command, len(line), line)
95
+			}
96
+			if home != "" && strings.Contains(line, home) {
97
+				t.Fatalf("Help for %q should use ~ instead of %q on:\n%s", command, home, line)
98
+			}
99
+		}
100
+	}
101
+
102
+	logDone("help - cmd widths")
103
+}
... ...
@@ -86,6 +86,7 @@ import (
86 86
 	"fmt"
87 87
 	"io"
88 88
 	"os"
89
+	"runtime"
89 90
 	"sort"
90 91
 	"strconv"
91 92
 	"strings"
... ...
@@ -503,6 +504,10 @@ func Set(name, value string) error {
503 503
 // otherwise, the default values of all defined flags in the set.
504 504
 func (f *FlagSet) PrintDefaults() {
505 505
 	writer := tabwriter.NewWriter(f.Out(), 20, 1, 3, ' ', 0)
506
+	var home string
507
+	if runtime.GOOS != "windows" {
508
+		home = os.Getenv("HOME")
509
+	}
506 510
 	f.VisitAll(func(flag *Flag) {
507 511
 		format := "  -%s=%s"
508 512
 		if _, ok := flag.Value.(*stringValue); ok {
... ...
@@ -516,7 +521,13 @@ func (f *FlagSet) PrintDefaults() {
516 516
 			}
517 517
 		}
518 518
 		if len(names) > 0 {
519
-			fmt.Fprintf(writer, format, strings.Join(names, ", -"), flag.DefValue)
519
+			val := flag.DefValue
520
+
521
+			if home != "" && strings.HasPrefix(val, home) {
522
+				val = "~" + val[len(home):]
523
+			}
524
+
525
+			fmt.Fprintf(writer, format, strings.Join(names, ", -"), val)
520 526
 			for i, line := range strings.Split(flag.Usage, "\n") {
521 527
 				if i != 0 {
522 528
 					line = "  " + line
... ...
@@ -48,9 +48,9 @@ func IndexServerName() string {
48 48
 // the current process.
49 49
 func (options *Options) InstallFlags() {
50 50
 	options.Mirrors = opts.NewListOpts(ValidateMirror)
51
-	flag.Var(&options.Mirrors, []string{"-registry-mirror"}, "Specify a preferred Docker registry mirror")
51
+	flag.Var(&options.Mirrors, []string{"-registry-mirror"}, "Preferred Docker registry mirror")
52 52
 	options.InsecureRegistries = opts.NewListOpts(ValidateIndexName)
53
-	flag.Var(&options.InsecureRegistries, []string{"-insecure-registry"}, "Enable insecure communication with specified registries (no certificate verification for HTTPS and enable HTTP fallback) (e.g., localhost:5000 or 10.20.0.0/16)")
53
+	flag.Var(&options.InsecureRegistries, []string{"-insecure-registry"}, "Enable insecure registry communication")
54 54
 }
55 55
 
56 56
 type netIPNet net.IPNet
... ...
@@ -46,42 +46,39 @@ func Parse(cmd *flag.FlagSet, args []string) (*Config, *HostConfig, *flag.FlagSe
46 46
 
47 47
 		flNetwork         = cmd.Bool([]string{"#n", "#-networking"}, true, "Enable networking for this container")
48 48
 		flPrivileged      = cmd.Bool([]string{"#privileged", "-privileged"}, false, "Give extended privileges to this container")
49
-		flPidMode         = cmd.String([]string{"-pid"}, "", "Default is to create a private PID namespace for the container\n'host': use the host PID namespace inside the container.  Note: the host mode gives the container full access to processes on the system and is therefore considered insecure.")
50
-		flPublishAll      = cmd.Bool([]string{"P", "-publish-all"}, false, "Publish all exposed ports to random ports on the host interfaces")
49
+		flPidMode         = cmd.String([]string{"-pid"}, "", "PID namespace to use")
50
+		flPublishAll      = cmd.Bool([]string{"P", "-publish-all"}, false, "Publish all exposed ports to random ports")
51 51
 		flStdin           = cmd.Bool([]string{"i", "-interactive"}, false, "Keep STDIN open even if not attached")
52 52
 		flTty             = cmd.Bool([]string{"t", "-tty"}, false, "Allocate a pseudo-TTY")
53 53
 		flContainerIDFile = cmd.String([]string{"#cidfile", "-cidfile"}, "", "Write the container ID to the file")
54 54
 		flEntrypoint      = cmd.String([]string{"#entrypoint", "-entrypoint"}, "", "Overwrite the default ENTRYPOINT of the image")
55 55
 		flHostname        = cmd.String([]string{"h", "-hostname"}, "", "Container host name")
56
-		flMemoryString    = cmd.String([]string{"m", "-memory"}, "", "Memory limit (format: <number><optional unit>, where unit = b, k, m or g)")
57
-		flMemorySwap      = cmd.String([]string{"-memory-swap"}, "", "Total memory usage (memory + swap), set '-1' to disable swap (format: <number><optional unit>, where unit = b, k, m or g)")
56
+		flMemoryString    = cmd.String([]string{"m", "-memory"}, "", "Memory limit")
57
+		flMemorySwap      = cmd.String([]string{"-memory-swap"}, "", "Total memory (memory + swap), '-1' to disable swap")
58 58
 		flUser            = cmd.String([]string{"u", "-user"}, "", "Username or UID")
59 59
 		flWorkingDir      = cmd.String([]string{"w", "-workdir"}, "", "Working directory inside the container")
60 60
 		flCpuShares       = cmd.Int64([]string{"c", "-cpu-shares"}, 0, "CPU shares (relative weight)")
61 61
 		flCpuset          = cmd.String([]string{"-cpuset"}, "", "CPUs in which to allow execution (0-3, 0,1)")
62
-		flNetMode         = cmd.String([]string{"-net"}, "bridge", "Set the Network mode for the container\n'bridge': creates a new network stack for the container on the docker bridge\n'none': no networking for this container\n'container:<name|id>': reuses another container network stack\n'host': use the host network stack inside the container.  Note: the host mode gives the container full access to local system services such as D-bus and is therefore considered insecure.")
62
+		flNetMode         = cmd.String([]string{"-net"}, "bridge", "Set the Network mode for the container")
63 63
 		flMacAddress      = cmd.String([]string{"-mac-address"}, "", "Container MAC address (e.g. 92:d0:c6:0a:29:33)")
64
-		flIpcMode         = cmd.String([]string{"-ipc"}, "", "Default is to create a private IPC namespace (POSIX SysV IPC) for the container\n'container:<name|id>': reuses another container shared memory, semaphores and message queues\n'host': use the host shared memory,semaphores and message queues inside the container.  Note: the host mode gives the container full access to local shared memory and is therefore considered insecure.")
65
-		flRestartPolicy   = cmd.String([]string{"-restart"}, "", "Restart policy to apply when a container exits (no, on-failure[:max-retry], always)")
64
+		flIpcMode         = cmd.String([]string{"-ipc"}, "", "IPC namespace to use")
65
+		flRestartPolicy   = cmd.String([]string{"-restart"}, "", "Restart policy to apply when a container exits")
66 66
 		flReadonlyRootfs  = cmd.Bool([]string{"-read-only"}, false, "Mount the container's root filesystem as read only")
67 67
 	)
68 68
 
69 69
 	cmd.Var(&flAttach, []string{"a", "-attach"}, "Attach to STDIN, STDOUT or STDERR.")
70
-	cmd.Var(&flVolumes, []string{"v", "-volume"}, "Bind mount a volume (e.g., from the host: -v /host:/container, from Docker: -v /container)")
71
-	cmd.Var(&flLinks, []string{"#link", "-link"}, "Add link to another container in the form of <name|id>:alias")
72
-	cmd.Var(&flDevices, []string{"-device"}, "Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc:rwm)")
73
-
70
+	cmd.Var(&flVolumes, []string{"v", "-volume"}, "Bind mount a volume")
71
+	cmd.Var(&flLinks, []string{"#link", "-link"}, "Add link to another container")
72
+	cmd.Var(&flDevices, []string{"-device"}, "Add a host device to the container")
74 73
 	cmd.Var(&flEnv, []string{"e", "-env"}, "Set environment variables")
75
-	cmd.Var(&flEnvFile, []string{"-env-file"}, "Read in a line delimited file of environment variables")
76
-
77
-	cmd.Var(&flPublish, []string{"p", "-publish"}, fmt.Sprintf("Publish a container's port to the host\nformat: %s\n(use 'docker port' to see the actual mapping)", nat.PortSpecTemplateFormat))
78
-	cmd.Var(&flExpose, []string{"#expose", "-expose"}, "Expose a port or a range of ports (e.g. --expose=3300-3310) from the container without publishing it to your host")
74
+	cmd.Var(&flEnvFile, []string{"-env-file"}, "Read in a file of environment variables")
75
+	cmd.Var(&flPublish, []string{"p", "-publish"}, "Publish a container's port(s) to the host")
76
+	cmd.Var(&flExpose, []string{"#expose", "-expose"}, "Expose a port or a range of ports")
79 77
 	cmd.Var(&flDns, []string{"#dns", "-dns"}, "Set custom DNS servers")
80
-	cmd.Var(&flDnsSearch, []string{"-dns-search"}, "Set custom DNS search domains (Use --dns-search=. if you don't wish to set the search domain)")
78
+	cmd.Var(&flDnsSearch, []string{"-dns-search"}, "Set custom DNS search domains")
81 79
 	cmd.Var(&flExtraHosts, []string{"-add-host"}, "Add a custom host-to-IP mapping (host:ip)")
82 80
 	cmd.Var(&flVolumesFrom, []string{"#volumes-from", "-volumes-from"}, "Mount volumes from the specified container(s)")
83
-	cmd.Var(&flLxcOpts, []string{"#lxc-conf", "-lxc-conf"}, "(lxc exec-driver only) Add custom lxc options --lxc-conf=\"lxc.cgroup.cpuset.cpus = 0,1\"")
84
-
81
+	cmd.Var(&flLxcOpts, []string{"#lxc-conf", "-lxc-conf"}, "Add custom lxc options")
85 82
 	cmd.Var(&flCapAdd, []string{"-cap-add"}, "Add Linux capabilities")
86 83
 	cmd.Var(&flCapDrop, []string{"-cap-drop"}, "Drop Linux capabilities")
87 84
 	cmd.Var(&flSecurityOpt, []string{"-security-opt"}, "Security Options")