Browse code

Improve flag help consistency, and update docs

This adds the `--live-restore` option to the documentation.

Also synched usage description in the documentation
with the actual description, and re-phrased some
flag descriptions to be a bit more consistent.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2016/07/16 08:52:59
Showing 12 changed files
... ...
@@ -31,7 +31,7 @@ func main() {
31 31
 	flag.Merge(flag.CommandLine, daemonCli.commonFlags.FlagSet)
32 32
 
33 33
 	flag.Usage = func() {
34
-		fmt.Fprint(stdout, "Usage: dockerd [ --help | -v | --version ]\n\n")
34
+		fmt.Fprint(stdout, "Usage: dockerd [OPTIONS]\n\n")
35 35
 		fmt.Fprint(stdout, "A self-sufficient runtime for containers.\n\nOptions:\n")
36 36
 
37 37
 		flag.CommandLine.SetOutput(stdout)
... ...
@@ -1551,13 +1551,13 @@ __docker_subcommand() {
1551 1551
                 "($help)--default-gateway[Container default gateway IPv4 address]:IPv4 address: " \
1552 1552
                 "($help)--default-gateway-v6[Container default gateway IPv6 address]:IPv6 address: " \
1553 1553
                 "($help)--cluster-store=[URL of the distributed storage backend]:Cluster Store:->cluster-store" \
1554
-                "($help)--cluster-advertise=[Address of the daemon instance to advertise]:Instance to advertise (host\:port): " \
1555
-                "($help)*--cluster-store-opt=[Cluster options]:Cluster options:->cluster-store-options" \
1554
+                "($help)--cluster-advertise=[Address or interface name to advertise]:Instance to advertise (host\:port): " \
1555
+                "($help)*--cluster-store-opt=[Cluster store options]:Cluster options:->cluster-store-options" \
1556 1556
                 "($help)*--dns=[DNS server to use]:DNS: " \
1557 1557
                 "($help)*--dns-search=[DNS search domains to use]:DNS search: " \
1558 1558
                 "($help)*--dns-opt=[DNS options to use]:DNS option: " \
1559
-                "($help)*--default-ulimit=[Default ulimit settings for containers]:ulimit: " \
1560
-                "($help)--disable-legacy-registry[Do not contact legacy registries]" \
1559
+                "($help)*--default-ulimit=[Default ulimits for containers]:ulimit: " \
1560
+                "($help)--disable-legacy-registry[Disable contacting legacy registries]" \
1561 1561
                 "($help)*--exec-opt=[Runtime execution options]:runtime execution options: " \
1562 1562
                 "($help)--exec-root=[Root directory for execution state files]:path:_directories" \
1563 1563
                 "($help)--fixed-cidr=[IPv4 subnet for fixed IPs]:IPv4 subnet: " \
... ...
@@ -1576,7 +1576,7 @@ __docker_subcommand() {
1576 1576
                 "($help)*--label=[Key=value labels]:label: " \
1577 1577
                 "($help)--live-restore[Enable live restore of docker when containers are still running]" \
1578 1578
                 "($help)--log-driver=[Default driver for container logs]:Logging driver:(awslogs etwlogs fluentd gcplogs gelf journald json-file none splunk syslog)" \
1579
-                "($help)*--log-opt=[Log driver specific options]:log driver options:__docker_log_options" \
1579
+                "($help)*--log-opt=[Default log driver options for containers]:log driver options:__docker_log_options" \
1580 1580
                 "($help)--max-concurrent-downloads[Set the max concurrent downloads for each pull]" \
1581 1581
                 "($help)--max-concurrent-uploads[Set the max concurrent uploads for each push]" \
1582 1582
                 "($help)--mtu=[Network MTU]:mtu:(0 576 1420 1500 9000)" \
... ...
@@ -1896,7 +1896,7 @@ __docker_subcommand() {
1896 1896
                 "($help)--runtime=[Name of the runtime to be used for that container]:runtime:__docker_complete_runtimes" \
1897 1897
                 "($help)--sig-proxy[Proxy all received signals to the process (non-TTY mode only)]" \
1898 1898
                 "($help)--stop-signal=[Signal to kill a container]:signal:_signals" \
1899
-                "($help)--storage-opt=[Set storage driver options per container]:storage options:->storage-opt" \
1899
+                "($help)--storage-opt=[Storage driver options for the container]:storage options:->storage-opt" \
1900 1900
                 "($help -): :__docker_images" \
1901 1901
                 "($help -):command: _command_names -e" \
1902 1902
                 "($help -)*::arguments: _normal" && ret=0
... ...
@@ -144,9 +144,9 @@ func (config *Config) InstallCommonFlags(cmd *flag.FlagSet, usageFn func(string)
144 144
 
145 145
 	config.ServiceOptions.InstallCliFlags(cmd, usageFn)
146 146
 
147
-	cmd.Var(opts.NewNamedListOptsRef("storage-opts", &config.GraphOptions, nil), []string{"-storage-opt"}, usageFn("Set storage driver options"))
148
-	cmd.Var(opts.NewNamedListOptsRef("authorization-plugins", &config.AuthorizationPlugins, nil), []string{"-authorization-plugin"}, usageFn("List authorization plugins in order from first evaluator to last"))
149
-	cmd.Var(opts.NewNamedListOptsRef("exec-opts", &config.ExecOptions, nil), []string{"-exec-opt"}, usageFn("Set runtime execution options"))
147
+	cmd.Var(opts.NewNamedListOptsRef("storage-opts", &config.GraphOptions, nil), []string{"-storage-opt"}, usageFn("Storage driver options"))
148
+	cmd.Var(opts.NewNamedListOptsRef("authorization-plugins", &config.AuthorizationPlugins, nil), []string{"-authorization-plugin"}, usageFn("Authorization plugins to load"))
149
+	cmd.Var(opts.NewNamedListOptsRef("exec-opts", &config.ExecOptions, nil), []string{"-exec-opt"}, usageFn("Runtime execution options"))
150 150
 	cmd.StringVar(&config.Pidfile, []string{"p", "-pidfile"}, defaultPidFile, usageFn("Path to use for daemon PID file"))
151 151
 	cmd.StringVar(&config.Root, []string{"g", "-graph"}, defaultGraph, usageFn("Root of the Docker runtime"))
152 152
 	cmd.BoolVar(&config.AutoRestart, []string{"#r", "#-restart"}, true, usageFn("--restart on the daemon has been deprecated in favor of --restart policies on docker run"))
... ...
@@ -159,9 +159,9 @@ func (config *Config) InstallCommonFlags(cmd *flag.FlagSet, usageFn func(string)
159 159
 	cmd.Var(opts.NewListOptsRef(&config.DNSSearch, opts.ValidateDNSSearch), []string{"-dns-search"}, usageFn("DNS search domains to use"))
160 160
 	cmd.Var(opts.NewNamedListOptsRef("labels", &config.Labels, opts.ValidateLabel), []string{"-label"}, usageFn("Set key=value labels to the daemon"))
161 161
 	cmd.StringVar(&config.LogConfig.Type, []string{"-log-driver"}, "json-file", usageFn("Default driver for container logs"))
162
-	cmd.Var(opts.NewNamedMapOpts("log-opts", config.LogConfig.Config, nil), []string{"-log-opt"}, usageFn("Set log driver options"))
162
+	cmd.Var(opts.NewNamedMapOpts("log-opts", config.LogConfig.Config, nil), []string{"-log-opt"}, usageFn("Default log driver options for containers"))
163 163
 	cmd.StringVar(&config.ClusterAdvertise, []string{"-cluster-advertise"}, "", usageFn("Address or interface name to advertise"))
164
-	cmd.StringVar(&config.ClusterStore, []string{"-cluster-store"}, "", usageFn("Set the cluster store"))
164
+	cmd.StringVar(&config.ClusterStore, []string{"-cluster-store"}, "", usageFn("URL of the distributed storage backend"))
165 165
 	cmd.Var(opts.NewNamedMapOpts("cluster-store-opts", config.ClusterOpts, nil), []string{"-cluster-store-opt"}, usageFn("Set cluster store options"))
166 166
 	cmd.StringVar(&config.CorsHeaders, []string{"-api-cors-header"}, "", usageFn("Set CORS headers in the remote API"))
167 167
 	cmd.IntVar(&maxConcurrentDownloads, []string{"-max-concurrent-downloads"}, defaultMaxConcurrentDownloads, usageFn("Set the max concurrent downloads for each pull"))
... ...
@@ -68,7 +68,7 @@ func (config *Config) InstallFlags(cmd *flag.FlagSet, usageFn func(string) strin
68 68
 	cmd.BoolVar(&config.EnableSelinuxSupport, []string{"-selinux-enabled"}, false, usageFn("Enable selinux support"))
69 69
 	cmd.StringVar(&config.SocketGroup, []string{"G", "-group"}, "docker", usageFn("Group for the unix socket"))
70 70
 	config.Ulimits = make(map[string]*units.Ulimit)
71
-	cmd.Var(runconfigopts.NewUlimitOpt(&config.Ulimits), []string{"-default-ulimit"}, usageFn("Set default ulimits for containers"))
71
+	cmd.Var(runconfigopts.NewUlimitOpt(&config.Ulimits), []string{"-default-ulimit"}, usageFn("Default ulimits for containers"))
72 72
 	cmd.BoolVar(&config.bridgeConfig.EnableIPTables, []string{"#iptables", "-iptables"}, true, usageFn("Enable addition of iptables rules"))
73 73
 	cmd.BoolVar(&config.bridgeConfig.EnableIPForward, []string{"#ip-forward", "-ip-forward"}, true, usageFn("Enable net.ipv4.ip_forward"))
74 74
 	cmd.BoolVar(&config.bridgeConfig.EnableIPMasq, []string{"-ip-masq"}, true, usageFn("Enable IP masquerading"))
... ...
@@ -90,7 +90,7 @@ func (config *Config) InstallFlags(cmd *flag.FlagSet, usageFn func(string) strin
90 90
 	cmd.BoolVar(&config.LiveRestore, []string{"-live-restore"}, false, usageFn("Enable live restore of docker when containers are still running"))
91 91
 	config.Runtimes = make(map[string]types.Runtime)
92 92
 	cmd.Var(runconfigopts.NewNamedRuntimeOpt("runtimes", &config.Runtimes, stockRuntimeName), []string{"-add-runtime"}, usageFn("Register an additional OCI compatible runtime"))
93
-	cmd.StringVar(&config.DefaultRuntime, []string{"-default-runtime"}, stockRuntimeName, usageFn("Default OCI runtime to be used"))
93
+	cmd.StringVar(&config.DefaultRuntime, []string{"-default-runtime"}, stockRuntimeName, usageFn("Default OCI runtime for containers"))
94 94
 	cmd.IntVar(&config.OOMScoreAdjust, []string{"-oom-score-adjust"}, -500, usageFn("Set the oom_score_adj for the daemon"))
95 95
 
96 96
 	config.attachExperimentalFlags(cmd, usageFn)
... ...
@@ -64,7 +64,7 @@ Options:
64 64
       --label-file value            Read in a line delimited file of labels (default [])
65 65
       --link value                  Add link to another container (default [])
66 66
       --link-local-ip value         Container IPv4/IPv6 link-local addresses (default [])
67
-      --log-driver string           Logging driver for container
67
+      --log-driver string           Logging driver for the container
68 68
       --log-opt value               Log driver options (default [])
69 69
       --mac-address string          Container MAC address (e.g. 92:d0:c6:0a:29:33)
70 70
   -m, --memory string               Memory limit
... ...
@@ -97,7 +97,7 @@ Options:
97 97
                                     Unit is optional and can be `b` (bytes), `k` (kilobytes), `m` (megabytes),
98 98
                                     or `g` (gigabytes). If you omit the unit, the system uses bytes.
99 99
       --stop-signal string          Signal to stop a container, SIGTERM by default (default "SIGTERM")
100
-      --storage-opt value           Set storage driver options per container (default [])
100
+      --storage-opt value           Storage driver options for the container (default [])
101 101
       --sysctl value                Sysctl options (default map[])
102 102
       --tmpfs value                 Mount a tmpfs directory (default [])
103 103
   -t, --tty                         Allocate a pseudo-TTY
... ...
@@ -12,35 +12,45 @@ weight = -1
12 12
 
13 13
 # daemon
14 14
 
15
+```markdown
15 16
     Usage: dockerd [OPTIONS]
16 17
 
17
-    A self-sufficient runtime for linux containers.
18
+    A self-sufficient runtime for containers.
18 19
 
19 20
     Options:
21
+
22
+Usage: dockerd [OPTIONS]
23
+
24
+A self-sufficient runtime for containers.
25
+
26
+Options:
27
+
20 28
       --add-runtime=[]                       Register an additional OCI compatible runtime
21
-      --api-cors-header=""                   Set CORS headers in the remote API
22
-      --authorization-plugin=[]              Set authorization plugins to load
23
-      -b, --bridge=""                        Attach containers to a network bridge
24
-      --bip=""                               Specify network bridge IP
25
-      --cgroup-parent=                       Set parent cgroup for all containers
26
-      --cluster-store=""                     URL of the distributed storage backend
27
-      --cluster-advertise=""                 Address of the daemon instance on the cluster
28
-      --cluster-store-opt=map[]              Set cluster options
29
+      --api-cors-header                      Set CORS headers in the remote API
30
+      --authorization-plugin=[]              Authorization plugins to load
31
+      -b, --bridge                           Attach containers to a network bridge
32
+      --bip                                  Specify network bridge IP
33
+      --cgroup-parent                        Set parent cgroup for all containers
34
+      --cluster-advertise                    Address or interface name to advertise
35
+      --cluster-store                        URL of the distributed storage backend
36
+      --cluster-store-opt=map[]              Set cluster store options
29 37
       --config-file=/etc/docker/daemon.json  Daemon configuration file
30 38
       --containerd                           Path to containerd socket
31 39
       -D, --debug                            Enable debug mode
32
-      --default-gateway=""                   Container default gateway IPv4 address
33
-      --default-gateway-v6=""                Container default gateway IPv6 address
40
+      --default-gateway                      Container default gateway IPv4 address
41
+      --default-gateway-v6                   Container default gateway IPv6 address
42
+      --default-runtime=runc                 Default OCI runtime for containers
43
+      --default-ulimit=[]                    Default ulimits for containers
44
+      --disable-legacy-registry              Disable contacting legacy registries
34 45
       --dns=[]                               DNS server to use
35 46
       --dns-opt=[]                           DNS options to use
36 47
       --dns-search=[]                        DNS search domains to use
37
-      --default-ulimit=[]                    Set default ulimit settings for containers
38
-      --exec-opt=[]                          Set runtime execution options
39
-      --exec-root="/var/run/docker"          Root directory for execution state files
40
-      --fixed-cidr=""                        IPv4 subnet for fixed IPs
41
-      --fixed-cidr-v6=""                     IPv6 subnet for fixed IPs
42
-      -G, --group="docker"                   Group for the unix socket
43
-      -g, --graph="/var/lib/docker"          Root of the Docker runtime
48
+      --exec-opt=[]                          Runtime execution options
49
+      --exec-root=/var/run/docker            Root directory for execution state files
50
+      --fixed-cidr                           IPv4 subnet for fixed IPs
51
+      --fixed-cidr-v6                        IPv6 subnet for fixed IPs
52
+      -G, --group=docker                     Group for the unix socket
53
+      -g, --graph=/var/lib/docker            Root of the Docker runtime
44 54
       -H, --host=[]                          Daemon socket(s) to connect to
45 55
       --help                                 Print usage
46 56
       --icc=true                             Enable inter-container communication
... ...
@@ -50,28 +60,30 @@ weight = -1
50 50
       --ip-masq=true                         Enable IP masquerading
51 51
       --iptables=true                        Enable addition of iptables rules
52 52
       --ipv6                                 Enable IPv6 networking
53
-      -l, --log-level="info"                 Set the logging level
53
+      -l, --log-level=info                   Set the logging level
54 54
       --label=[]                             Set key=value labels to the daemon
55
-      --log-driver="json-file"               Default driver for container logs
56
-      --log-opt=[]                           Log driver specific options
55
+      --live-restore                         Enable live restore of docker when containers are still running
56
+      --log-driver=json-file                 Default driver for container logs
57
+      --log-opt=map[]                        Default log driver options for containers
57 58
       --max-concurrent-downloads=3           Set the max concurrent downloads for each pull
58 59
       --max-concurrent-uploads=5             Set the max concurrent uploads for each push
59
-      --mtu=0                                Set the containers network MTU
60
+      --mtu                                  Set the containers network MTU
60 61
       --oom-score-adjust=-500                Set the oom_score_adj for the daemon
61
-      --disable-legacy-registry              Do not contact legacy registries
62
-      -p, --pidfile="/var/run/docker.pid"    Path to use for daemon PID file
62
+      -p, --pidfile=/var/run/docker.pid      Path to use for daemon PID file
63 63
       --raw-logs                             Full timestamps without ANSI coloring
64 64
       --registry-mirror=[]                   Preferred Docker registry mirror
65
-      -s, --storage-driver=""                Storage driver to use
65
+      -s, --storage-driver                   Storage driver to use
66 66
       --selinux-enabled                      Enable selinux support
67
-      --storage-opt=[]                       Set storage driver options
67
+      --storage-opt=[]                       Storage driver options
68 68
       --tls                                  Use TLS; implied by --tlsverify
69
-      --tlscacert="~/.docker/ca.pem"         Trust certs signed only by this CA
70
-      --tlscert="~/.docker/cert.pem"         Path to TLS certificate file
71
-      --tlskey="~/.docker/key.pem"           Path to TLS key file
69
+      --tlscacert=~/.docker/ca.pem           Trust certs signed only by this CA
70
+      --tlscert=~/.docker/cert.pem           Path to TLS certificate file
71
+      --tlskey=~/.docker/key.pem             Path to TLS key file
72 72
       --tlsverify                            Use TLS and verify the remote
73
-      --userns-remap="default"               Enable user namespace remapping
74 73
       --userland-proxy=true                  Use userland proxy for loopback traffic
74
+      --userns-remap                         User/Group setting for user namespaces
75
+      -v, --version                          Print version information and quit
76
+```
75 77
 
76 78
 Options with [] may be specified multiple times.
77 79
 
... ...
@@ -70,7 +70,7 @@ Options:
70 70
       --label-file value            Read in a line delimited file of labels (default [])
71 71
       --link value                  Add link to another container (default [])
72 72
       --link-local-ip value         Container IPv4/IPv6 link-local addresses (default [])
73
-      --log-driver string           Logging driver for container
73
+      --log-driver string           Logging driver for the container
74 74
       --log-opt value               Log driver options (default [])
75 75
       --mac-address string          Container MAC address (e.g. 92:d0:c6:0a:29:33)
76 76
   -m, --memory string               Memory limit
... ...
@@ -105,7 +105,7 @@ Options:
105 105
                                     or `g` (gigabytes). If you omit the unit, the system uses bytes.
106 106
       --sig-proxy                   Proxy received signals to the process (default true)
107 107
       --stop-signal string          Signal to stop a container, SIGTERM by default (default "SIGTERM")
108
-      --storage-opt value           Set storage driver options per container (default [])
108
+      --storage-opt value           Storage driver options for the container (default [])
109 109
       --sysctl value                Sysctl options (default map[])
110 110
       --tmpfs value                 Mount a tmpfs directory (default [])
111 111
   -t, --tty                         Allocate a pseudo-TTY
... ...
@@ -225,7 +225,7 @@ millions of trillions.
225 225
    Add one or more link-local IPv4/IPv6 addresses to the container's interface
226 226
 
227 227
 **--log-driver**="*json-file*|*syslog*|*journald*|*gelf*|*fluentd*|*awslogs*|*splunk*|*etwlogs*|*gcplogs*|*none*"
228
-  Logging driver for container. Default is defined by daemon `--log-driver` flag.
228
+  Logging driver for the container. Default is defined by daemon `--log-driver` flag.
229 229
   **Warning**: the `docker logs` command works only for the `json-file` and
230 230
   `journald` logging drivers.
231 231
 
... ...
@@ -331,7 +331,7 @@ which interface and port to use.
331 331
    Add one or more link-local IPv4/IPv6 addresses to the container's interface
332 332
 
333 333
 **--log-driver**="*json-file*|*syslog*|*journald*|*gelf*|*fluentd*|*awslogs*|*splunk*|*etwlogs*|*gcplogs*|*none*"
334
-  Logging driver for container. Default is defined by daemon `--log-driver` flag.
334
+  Logging driver for the container. Default is defined by daemon `--log-driver` flag.
335 335
   **Warning**: the `docker logs` command works only for the `json-file` and
336 336
   `journald` logging drivers.
337 337
 
... ...
@@ -121,10 +121,10 @@ format.
121 121
   IPv6 address of the container default gateway
122 122
 
123 123
 **--default-ulimit**=[]
124
-  Set default ulimits for containers.
124
+  Default ulimits for containers.
125 125
 
126 126
 **--disable-legacy-registry**=*true*|*false*
127
-  Do not contact legacy registries
127
+  Disable contacting legacy registries
128 128
 
129 129
 **--dns**=""
130 130
   Force Docker to use specific DNS servers
... ...
@@ -77,7 +77,7 @@ func (options *ServiceOptions) InstallCliFlags(cmd *flag.FlagSet, usageFn func(s
77 77
 	insecureRegistries := opts.NewNamedListOptsRef("insecure-registries", &options.InsecureRegistries, ValidateIndexName)
78 78
 	cmd.Var(insecureRegistries, []string{"-insecure-registry"}, usageFn("Enable insecure registry communication"))
79 79
 
80
-	cmd.BoolVar(&options.V2Only, []string{"-disable-legacy-registry"}, false, usageFn("Do not contact legacy registries"))
80
+	cmd.BoolVar(&options.V2Only, []string{"-disable-legacy-registry"}, false, usageFn("Disable contacting legacy registries"))
81 81
 }
82 82
 
83 83
 // newServiceConfig returns a new instance of ServiceConfig
... ...
@@ -194,10 +194,10 @@ func AddFlags(flags *pflag.FlagSet) *ContainerOptions {
194 194
 	flags.MarkHidden("net-alias")
195 195
 
196 196
 	// Logging and storage
197
-	flags.StringVar(&copts.flLoggingDriver, "log-driver", "", "Logging driver for container")
197
+	flags.StringVar(&copts.flLoggingDriver, "log-driver", "", "Logging driver for the container")
198 198
 	flags.StringVar(&copts.flVolumeDriver, "volume-driver", "", "Optional volume driver for the container")
199 199
 	flags.Var(&copts.flLoggingOpts, "log-opt", "Log driver options")
200
-	flags.Var(&copts.flStorageOpt, "storage-opt", "Set storage driver options per container")
200
+	flags.Var(&copts.flStorageOpt, "storage-opt", "Storage driver options for the container")
201 201
 	flags.Var(&copts.flTmpfs, "tmpfs", "Mount a tmpfs directory")
202 202
 	flags.Var(&copts.flVolumesFrom, "volumes-from", "Mount volumes from the specified container(s)")
203 203
 	flags.VarP(&copts.flVolumes, "volume", "v", "Bind mount a volume")