浏览代码

Merge pull request #7574 from crosbymichael/update-restart-docs

Update flag usages and docs for max restart count
Michael Crosby 11 年之前
父节点
当前提交
b0abd6de63
共有 2 个文件被更改,包括 3 次插入2 次删除
  1. 2 1
      docs/sources/reference/commandline/cli.md
  2. 1 1
      runconfig/parse.go

+ 2 - 1
docs/sources/reference/commandline/cli.md

@@ -993,7 +993,7 @@ removed before the image is removed.
                                    format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort
                                    format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort
                                    (use 'docker port' to see the actual mapping)
                                    (use 'docker port' to see the actual mapping)
       --privileged=false         Give extended privileges to this container
       --privileged=false         Give extended privileges to this container
-      --restart=""               Restart policy to apply when a container exits (no, on-failure, always)
+      --restart=""               Restart policy to apply when a container exits (no, on-failure[:max-retry], always)
       --rm=false                 Automatically remove the container when it exits (incompatible with -d)
       --rm=false                 Automatically remove the container when it exits (incompatible with -d)
       --sig-proxy=true           Proxy received signals to the process (even in non-TTY mode). SIGCHLD, SIGSTOP, and SIGKILL are not proxied.
       --sig-proxy=true           Proxy received signals to the process (even in non-TTY mode). SIGCHLD, SIGSTOP, and SIGKILL are not proxied.
       -t, --tty=false            Allocate a pseudo-TTY
       -t, --tty=false            Allocate a pseudo-TTY
@@ -1245,6 +1245,7 @@ the container exits, Docker will restart it.
 This will run the `redis` container with a restart policy of ** on-failure ** and a
 This will run the `redis` container with a restart policy of ** on-failure ** and a
 maximum restart count of 10.  If the `redis` container exits with a non-zero exit
 maximum restart count of 10.  If the `redis` container exits with a non-zero exit
 status more than 10 times in a row Docker will abort trying to restart the container.
 status more than 10 times in a row Docker will abort trying to restart the container.
+Providing a maximum restart limit is only valid for the ** on-failure ** policy.
 
 
 ## save
 ## save
 
 

+ 1 - 1
runconfig/parse.go

@@ -73,7 +73,7 @@ func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf
 		flCpuShares       = cmd.Int64([]string{"c", "-cpu-shares"}, 0, "CPU shares (relative weight)")
 		flCpuShares       = cmd.Int64([]string{"c", "-cpu-shares"}, 0, "CPU shares (relative weight)")
 		flCpuset          = cmd.String([]string{"-cpuset"}, "", "CPUs in which to allow execution (0-3, 0,1)")
 		flCpuset          = cmd.String([]string{"-cpuset"}, "", "CPUs in which to allow execution (0-3, 0,1)")
 		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.")
 		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.")
-		flRestartPolicy   = cmd.String([]string{"-restart"}, "", "Restart policy to apply when a container exits (no, on-failure, always)")
+		flRestartPolicy   = cmd.String([]string{"-restart"}, "", "Restart policy to apply when a container exits (no, on-failure[:max-retry], always)")
 		// For documentation purpose
 		// For documentation purpose
 		_ = cmd.Bool([]string{"#sig-proxy", "-sig-proxy"}, true, "Proxy received signals to the process (even in non-TTY mode). SIGCHLD, SIGSTOP, and SIGKILL are not proxied.")
 		_ = cmd.Bool([]string{"#sig-proxy", "-sig-proxy"}, true, "Proxy received signals to the process (even in non-TTY mode). SIGCHLD, SIGSTOP, and SIGKILL are not proxied.")
 		_ = cmd.String([]string{"#name", "-name"}, "", "Assign a name to the container")
 		_ = cmd.String([]string{"#name", "-name"}, "", "Assign a name to the container")