Skip to content

Commit ecb59a2

Browse files
committed
Fixes moby#24083 : Improving cli help for flags with duration option
Signed-off-by: milindchawre <milindchawre@gmail.com>
1 parent 806f09b commit ecb59a2

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

cli/command/service/opts.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,8 @@ func addServiceFlags(cmd *cobra.Command, opts *serviceOptions) {
446446
flags.Var(&opts.restartPolicy.window, flagRestartWindow, "Window used to evaluate the restart policy")
447447

448448
flags.Uint64Var(&opts.update.parallelism, flagUpdateParallelism, 1, "Maximum number of tasks updated simultaneously (0 to update all at once)")
449-
flags.DurationVar(&opts.update.delay, flagUpdateDelay, time.Duration(0), "Delay between updates")
450-
flags.DurationVar(&opts.update.monitor, flagUpdateMonitor, time.Duration(0), "Duration after each task update to monitor for failure")
449+
flags.DurationVar(&opts.update.delay, flagUpdateDelay, time.Duration(0), "Delay between updates (ns|us|ms|s|m|h) (default 0s)")
450+
flags.DurationVar(&opts.update.monitor, flagUpdateMonitor, time.Duration(0), "Duration after each task update to monitor for failure (ns|us|ms|s|m|h) (default 0s)")
451451
flags.StringVar(&opts.update.onFailure, flagUpdateFailureAction, "pause", "Action on update failure (pause|continue)")
452452
flags.Float32Var(&opts.update.maxFailureRatio, flagUpdateMaxFailureRatio, 0, "Failure rate to tolerate during an update")
453453

cli/command/swarm/opts.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ func parseExternalCA(caSpec string) (*swarm.ExternalCA, error) {
168168

169169
func addSwarmFlags(flags *pflag.FlagSet, opts *swarmOptions) {
170170
flags.Int64Var(&opts.taskHistoryLimit, flagTaskHistoryLimit, 5, "Task history retention limit")
171-
flags.DurationVar(&opts.dispatcherHeartbeat, flagDispatcherHeartbeat, time.Duration(5*time.Second), "Dispatcher heartbeat period")
172-
flags.DurationVar(&opts.nodeCertExpiry, flagCertExpiry, time.Duration(90*24*time.Hour), "Validity period for node certificates")
171+
flags.DurationVar(&opts.dispatcherHeartbeat, flagDispatcherHeartbeat, time.Duration(5*time.Second), "Dispatcher heartbeat period (ns|us|ms|s|m|h) (default 5s)")
172+
flags.DurationVar(&opts.nodeCertExpiry, flagCertExpiry, time.Duration(90*24*time.Hour), "Validity period for node certificates (ns|us|ms|s|m|h) (default 2160h0m0s)")
173173
flags.Var(&opts.externalCA, flagExternalCA, "Specifications of one or more certificate signing endpoints")
174174
flags.Uint64Var(&opts.maxSnapshots, flagMaxSnapshots, 0, "Number of additional Raft snapshots to retain")
175175
flags.Uint64Var(&opts.snapshotInterval, flagSnapshotInterval, 10000, "Number of log entries between Raft snapshots")

docs/reference/commandline/create.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ Options:
5858
--expose value Expose a port or a range of ports (default [])
5959
--group-add value Add additional groups to join (default [])
6060
--health-cmd string Command to run to check health
61-
--health-interval duration Time between running the check
61+
--health-interval duration Time between running the check (ns|us|ms|s|m|h) (default 0s)
6262
--health-retries int Consecutive failures needed to report unhealthy
63-
--health-timeout duration Maximum time to allow one check to run
63+
--health-timeout duration Maximum time to allow one check to run (ns|us|ms|s|m|h) (default 0s)
6464
--help Print usage
6565
-h, --hostname string Container host name
6666
-i, --interactive Keep STDIN open even if not attached

docs/reference/commandline/run.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ Options:
6262
--expose value Expose a port or a range of ports (default [])
6363
--group-add value Add additional groups to join (default [])
6464
--health-cmd string Command to run to check health
65-
--health-interval duration Time between running the check
65+
--health-interval duration Time between running the check (ns|us|ms|s|m|h) (default 0s)
6666
--health-retries int Consecutive failures needed to report unhealthy
67-
--health-timeout duration Maximum time to allow one check to run
67+
--health-timeout duration Maximum time to allow one check to run (ns|us|ms|s|m|h) (default 0s)
6868
--help Print usage
6969
-h, --hostname string Container host name
7070
-i, --interactive Keep STDIN open even if not attached

docs/reference/commandline/service_create.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ Options:
3131
--env-file value Read in a file of environment variables (default [])
3232
--group value Set one or more supplementary user groups for the container (default [])
3333
--health-cmd string Command to run to check health
34-
--health-interval duration Time between running the check
34+
--health-interval duration Time between running the check (ns|us|ms|s|m|h) (default 0s)
3535
--health-retries int Consecutive failures needed to report unhealthy
36-
--health-timeout duration Maximum time to allow one check to run
36+
--health-timeout duration Maximum time to allow one check to run (ns|us|ms|s|m|h) (default 0s)
3737
--help Print usage
3838
--hostname Service containers hostname
3939
-l, --label value Service labels (default [])
@@ -56,10 +56,10 @@ Options:
5656
--restart-window value Window used to evaluate the restart policy (default none)
5757
--stop-grace-period value Time to wait before force killing a container (default none)
5858
-t, --tty Allocate a pseudo-TTY
59-
--update-delay duration Delay between updates
59+
--update-delay duration Delay between updates (ns|us|ms|s|m|h) (default 0s)
6060
--update-failure-action string Action on update failure (pause|continue) (default "pause")
6161
--update-max-failure-ratio value Failure rate to tolerate during an update
62-
--update-monitor duration Duration after each task update to monitor for failure (default 0s)
62+
--update-monitor duration Duration after each task update to monitor for failure (ns|us|ms|s|m|h) (default 0s)
6363
--update-parallelism uint Maximum number of tasks updated simultaneously (0 to update all at once) (default 1)
6464
-u, --user string Username or UID (format: <name|uid>[:<group|gid>])
6565
--with-registry-auth Send registry authentication details to Swarm agents

docs/reference/commandline/service_update.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ Options:
3939
--group-add stringSlice Add an additional supplementary user group to the container
4040
--group-rm list Remove a previously added supplementary user group from the container (default [])
4141
--health-cmd string Command to run to check health
42-
--health-interval duration-ptr Time between running the check (default none)
42+
--health-interval duration Time between running the check (ns|us|ms|s|m|h) (default 0s)
4343
--health-retries int Consecutive failures needed to report unhealthy
44-
--health-timeout duration-ptr Maximum time to allow one check to run (default none)
44+
--health-timeout duration Maximum time to allow one check to run (ns|us|ms|s|m|h) (default 0s)
4545
--help Print usage
4646
--image string Service image tag
4747
--label-add list Add or update a service label (default [])
@@ -65,10 +65,10 @@ Options:
6565
--rollback Rollback to previous specification
6666
--stop-grace-period duration-ptr Time to wait before force killing a container (default none)
6767
-t, --tty Allocate a pseudo-TTY
68-
--update-delay duration Delay between updates
68+
--update-delay duration Delay between updates (ns|us|ms|s|m|h) (default 0s)
6969
--update-failure-action string Action on update failure (pause|continue) (default "pause")
7070
--update-max-failure-ratio float32 Failure rate to tolerate during an update
71-
--update-monitor duration Duration after each task update to monitor for failure
71+
--update-monitor duration Duration after each task update to monitor for failure (ns|us|ms|s|m|h) (default 0s)
7272
--update-parallelism uint Maximum number of tasks updated simultaneously (0 to update all at once) (default 1)
7373
-u, --user string Username or UID (format: <name|uid>[:<group|gid>])
7474
--with-registry-auth Send registry authentication details to swarm agents

docs/reference/commandline/swarm_init.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ Initialize a swarm
2222

2323
Options:
2424
--advertise-addr value Advertised address (format: <ip|interface>[:port])
25-
--cert-expiry duration Validity period for node certificates (default 2160h0m0s)
26-
--dispatcher-heartbeat duration Dispatcher heartbeat period (default 5s)
25+
--cert-expiry duration Validity period for node certificates (ns|us|ms|s|m|h) (default 2160h0m0s)
26+
--dispatcher-heartbeat duration Dispatcher heartbeat period (ns|us|ms|s|m|h) (default 5s)
2727
--external-ca value Specifications of one or more certificate signing endpoints
2828
--force-new-cluster Force create a new cluster from current state
2929
--help Print usage

docs/reference/commandline/swarm_update.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ Usage: docker swarm update [OPTIONS]
2121
Update the swarm
2222

2323
Options:
24-
--cert-expiry duration Validity period for node certificates (default 2160h0m0s)
25-
--dispatcher-heartbeat duration Dispatcher heartbeat period (default 5s)
24+
--cert-expiry duration Validity period for node certificates (ns|us|ms|s|m|h) (default 2160h0m0s)
25+
--dispatcher-heartbeat duration Dispatcher heartbeat period (ns|us|ms|s|m|h) (default 5s)
2626
--external-ca value Specifications of one or more certificate signing endpoints
2727
--help Print usage
2828
--max-snapshots int Number of additional Raft snapshots to retain

runconfig/opts/parse.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ func AddFlags(flags *pflag.FlagSet) *ContainerOptions {
218218

219219
// Health-checking
220220
flags.StringVar(&copts.healthCmd, "health-cmd", "", "Command to run to check health")
221-
flags.DurationVar(&copts.healthInterval, "health-interval", 0, "Time between running the check")
221+
flags.DurationVar(&copts.healthInterval, "health-interval", 0, "Time between running the check (ns|us|ms|s|m|h) (default 0s)")
222222
flags.IntVar(&copts.healthRetries, "health-retries", 0, "Consecutive failures needed to report unhealthy")
223-
flags.DurationVar(&copts.healthTimeout, "health-timeout", 0, "Maximum time to allow one check to run")
223+
flags.DurationVar(&copts.healthTimeout, "health-timeout", 0, "Maximum time to allow one check to run (ns|us|ms|s|m|h) (default 0s)")
224224
flags.BoolVar(&copts.noHealthcheck, "no-healthcheck", false, "Disable any container-specified HEALTHCHECK")
225225

226226
// Resource management

0 commit comments

Comments
 (0)