Revert "--help option and help command should print to stdout not stderr"
This reverts commit 61b129d818
.
Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
parent
835800fcd5
commit
2e489073d9
38 changed files with 68 additions and 335 deletions
|
@ -52,8 +52,8 @@ func (cli *DockerCli) Cmd(args ...string) error {
|
|||
if len(args) > 0 {
|
||||
method, exists := cli.getMethod(args[0])
|
||||
if !exists {
|
||||
fmt.Fprintf(cli.err, "docker: '%s' is not a docker command. See 'docker --help'.\n", args[0])
|
||||
os.Exit(1)
|
||||
fmt.Println("Error: Command not found:", args[0])
|
||||
return cli.CmdHelp(args[1:]...)
|
||||
}
|
||||
return method(args[1:]...)
|
||||
}
|
||||
|
@ -63,10 +63,9 @@ func (cli *DockerCli) Cmd(args ...string) error {
|
|||
func (cli *DockerCli) Subcmd(name, signature, description string) *flag.FlagSet {
|
||||
flags := flag.NewFlagSet(name, flag.ContinueOnError)
|
||||
flags.Usage = func() {
|
||||
fmt.Fprintf(cli.out, "\nUsage: docker %s %s\n\n%s\n\n", name, signature, description)
|
||||
flags.SetOutput(cli.out)
|
||||
fmt.Fprintf(cli.err, "\nUsage: docker %s %s\n\n%s\n\n", name, signature, description)
|
||||
flags.PrintDefaults()
|
||||
os.Exit(0)
|
||||
os.Exit(2)
|
||||
}
|
||||
return flags
|
||||
}
|
||||
|
|
|
@ -48,8 +48,6 @@ func (cli *DockerCli) CmdHelp(args ...string) error {
|
|||
method, exists := cli.getMethod(args[0])
|
||||
if !exists {
|
||||
fmt.Fprintf(cli.err, "Error: Command not found: %s\n", args[0])
|
||||
fmt.Fprintf(cli.err, "docker: '%s' is not a docker command. See 'docker --help'.\n", args[0])
|
||||
os.Exit(1)
|
||||
} else {
|
||||
method("--help")
|
||||
return nil
|
||||
|
@ -95,7 +93,7 @@ func (cli *DockerCli) CmdHelp(args ...string) error {
|
|||
} {
|
||||
help += fmt.Sprintf(" %-10.10s%s\n", command[0], command[1])
|
||||
}
|
||||
fmt.Fprintf(cli.out, "%s\n", help)
|
||||
fmt.Fprintf(cli.err, "%s\n", help)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -106,18 +104,13 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
|
|||
noCache := cmd.Bool([]string{"#no-cache", "-no-cache"}, false, "Do not use cache when building the image")
|
||||
rm := cmd.Bool([]string{"#rm", "-rm"}, true, "Remove intermediate containers after a successful build")
|
||||
forceRm := cmd.Bool([]string{"-force-rm"}, false, "Always remove intermediate containers, even after unsuccessful builds")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
if cmd.NArg() != 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var (
|
||||
context archive.Archive
|
||||
|
@ -269,16 +262,10 @@ func (cli *DockerCli) CmdLogin(args ...string) error {
|
|||
cmd.StringVar(&username, []string{"u", "-username"}, "", "Username")
|
||||
cmd.StringVar(&password, []string{"p", "-password"}, "", "Password")
|
||||
cmd.StringVar(&email, []string{"e", "-email"}, "", "Email")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
err := cmd.Parse(args)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
serverAddress := registry.IndexServerAddress()
|
||||
if len(cmd.Args()) > 0 {
|
||||
serverAddress = cmd.Arg(0)
|
||||
|
@ -398,18 +385,13 @@ func (cli *DockerCli) CmdLogout(args ...string) error {
|
|||
// 'docker wait': block until a container stops
|
||||
func (cli *DockerCli) CmdWait(args ...string) error {
|
||||
cmd := cli.Subcmd("wait", "CONTAINER [CONTAINER...]", "Block until a container stops, then print its exit code.")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
if cmd.NArg() < 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
var encounteredError error
|
||||
for _, name := range cmd.Args() {
|
||||
status, err := waitForExit(cli, name)
|
||||
|
@ -429,8 +411,10 @@ func (cli *DockerCli) CmdVersion(args ...string) error {
|
|||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(0) {
|
||||
os.Exit(1)
|
||||
|
||||
if cmd.NArg() > 0 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if dockerversion.VERSION != "" {
|
||||
fmt.Fprintf(cli.out, "Client version: %s\n", dockerversion.VERSION)
|
||||
|
@ -473,8 +457,9 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
|
|||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(0) {
|
||||
os.Exit(1)
|
||||
if cmd.NArg() > 0 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
|
||||
body, _, err := readBody(cli.call("GET", "/info", nil, false))
|
||||
|
@ -546,18 +531,13 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
|
|||
func (cli *DockerCli) CmdStop(args ...string) error {
|
||||
cmd := cli.Subcmd("stop", "[OPTIONS] CONTAINER [CONTAINER...]", "Stop a running container by sending SIGTERM and then SIGKILL after a grace period")
|
||||
nSeconds := cmd.Int([]string{"t", "-time"}, 10, "Number of seconds to wait for the container to stop before killing it. Default is 10 seconds.")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
if cmd.NArg() < 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
v := url.Values{}
|
||||
v.Set("t", strconv.Itoa(*nSeconds))
|
||||
|
@ -578,18 +558,13 @@ func (cli *DockerCli) CmdStop(args ...string) error {
|
|||
func (cli *DockerCli) CmdRestart(args ...string) error {
|
||||
cmd := cli.Subcmd("restart", "[OPTIONS] CONTAINER [CONTAINER...]", "Restart a running container")
|
||||
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.")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
if cmd.NArg() < 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
v := url.Values{}
|
||||
v.Set("t", strconv.Itoa(*nSeconds))
|
||||
|
@ -641,19 +616,15 @@ func (cli *DockerCli) CmdStart(args ...string) error {
|
|||
cmd = cli.Subcmd("start", "CONTAINER [CONTAINER...]", "Restart a stopped container")
|
||||
attach = cmd.Bool([]string{"a", "-attach"}, false, "Attach container's STDOUT and STDERR and forward all signals to the process")
|
||||
openStdin = cmd.Bool([]string{"i", "-interactive"}, false, "Attach container's STDIN")
|
||||
help = cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
)
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
if cmd.NArg() < 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if *attach || *openStdin {
|
||||
if cmd.NArg() > 1 {
|
||||
|
@ -733,8 +704,10 @@ func (cli *DockerCli) CmdUnpause(args ...string) error {
|
|||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
|
||||
if cmd.NArg() != 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
|
||||
var encounteredError error
|
||||
|
@ -754,8 +727,10 @@ func (cli *DockerCli) CmdPause(args ...string) error {
|
|||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
|
||||
if cmd.NArg() != 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
|
||||
var encounteredError error
|
||||
|
@ -773,18 +748,13 @@ func (cli *DockerCli) CmdPause(args ...string) error {
|
|||
func (cli *DockerCli) CmdInspect(args ...string) error {
|
||||
cmd := cli.Subcmd("inspect", "CONTAINER|IMAGE [CONTAINER|IMAGE...]", "Return low-level information on a container or image")
|
||||
tmplStr := cmd.String([]string{"f", "#format", "-format"}, "", "Format the output using the given go template.")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
if cmd.NArg() < 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var tmpl *template.Template
|
||||
if *tmplStr != "" {
|
||||
|
@ -857,18 +827,13 @@ func (cli *DockerCli) CmdInspect(args ...string) error {
|
|||
|
||||
func (cli *DockerCli) CmdTop(args ...string) error {
|
||||
cmd := cli.Subcmd("top", "CONTAINER [ps OPTIONS]", "Display the running processes of a container")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
if cmd.NArg() == 0 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
val := url.Values{}
|
||||
if cmd.NArg() > 1 {
|
||||
val.Set("ps_args", strings.Join(cmd.Args()[1:], " "))
|
||||
|
@ -897,17 +862,13 @@ func (cli *DockerCli) CmdTop(args ...string) error {
|
|||
|
||||
func (cli *DockerCli) CmdPort(args ...string) error {
|
||||
cmd := cli.Subcmd("port", "CONTAINER PRIVATE_PORT", "Lookup the public-facing port that is NAT-ed to PRIVATE_PORT")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
if cmd.NArg() != 2 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(2) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var (
|
||||
port = cmd.Arg(1)
|
||||
|
@ -951,18 +912,13 @@ func (cli *DockerCli) CmdRmi(args ...string) error {
|
|||
force = cmd.Bool([]string{"f", "-force"}, false, "Force removal of the image")
|
||||
noprune = cmd.Bool([]string{"-no-prune"}, false, "Do not delete untagged parents")
|
||||
)
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
if cmd.NArg() < 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
v := url.Values{}
|
||||
if *force {
|
||||
|
@ -1001,18 +957,14 @@ func (cli *DockerCli) CmdHistory(args ...string) error {
|
|||
cmd := cli.Subcmd("history", "[OPTIONS] IMAGE", "Show the history of an image")
|
||||
quiet := cmd.Bool([]string{"q", "-quiet"}, false, "Only show numeric IDs")
|
||||
noTrunc := cmd.Bool([]string{"#notrunc", "-no-trunc"}, false, "Don't truncate output")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
if cmd.NArg() != 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
body, _, err := readBody(cli.call("GET", "/images/"+cmd.Arg(0)+"/history", nil, false))
|
||||
if err != nil {
|
||||
|
@ -1063,18 +1015,14 @@ func (cli *DockerCli) CmdRm(args ...string) error {
|
|||
v := cmd.Bool([]string{"v", "-volumes"}, false, "Remove the volumes associated with the container")
|
||||
link := cmd.Bool([]string{"l", "#link", "-link"}, false, "Remove the specified link and not the underlying container")
|
||||
force := cmd.Bool([]string{"f", "-force"}, false, "Force the removal of a running container (uses SIGKILL)")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
if cmd.NArg() < 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
val := url.Values{}
|
||||
if *v {
|
||||
|
@ -1105,18 +1053,14 @@ func (cli *DockerCli) CmdRm(args ...string) error {
|
|||
func (cli *DockerCli) CmdKill(args ...string) error {
|
||||
cmd := cli.Subcmd("kill", "[OPTIONS] CONTAINER [CONTAINER...]", "Kill a running container using SIGKILL or a specified signal")
|
||||
signal := cmd.String([]string{"s", "-signal"}, "KILL", "Signal to send to the container")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
if cmd.NArg() < 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var encounteredError error
|
||||
for _, name := range cmd.Args() {
|
||||
|
@ -1132,18 +1076,15 @@ func (cli *DockerCli) CmdKill(args ...string) error {
|
|||
|
||||
func (cli *DockerCli) CmdImport(args ...string) error {
|
||||
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.")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
if cmd.NArg() < 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(2) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var (
|
||||
v = url.Values{}
|
||||
src = cmd.Arg(0)
|
||||
|
@ -1177,15 +1118,9 @@ func (cli *DockerCli) CmdImport(args ...string) error {
|
|||
|
||||
func (cli *DockerCli) CmdPush(args ...string) error {
|
||||
cmd := cli.Subcmd("push", "NAME[:TAG]", "Push an image or a repository to the registry")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
name := cmd.Arg(0)
|
||||
|
||||
if name == "" {
|
||||
|
@ -1249,19 +1184,14 @@ func (cli *DockerCli) CmdPush(args ...string) error {
|
|||
func (cli *DockerCli) CmdPull(args ...string) error {
|
||||
cmd := cli.Subcmd("pull", "NAME[:TAG]", "Pull an image or a repository from the registry")
|
||||
tag := cmd.String([]string{"#t", "#-tag"}, "", "Download tagged image in a repository")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
|
||||
if cmd.NArg() != 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
var (
|
||||
v = url.Values{}
|
||||
remote = cmd.Arg(0)
|
||||
|
@ -1322,7 +1252,6 @@ func (cli *DockerCli) CmdImages(args ...string) error {
|
|||
// FIXME: --viz and --tree are deprecated. Remove them in a future version.
|
||||
flViz := cmd.Bool([]string{"#v", "#viz", "#-viz"}, false, "Output graph in graphviz format")
|
||||
flTree := cmd.Bool([]string{"#t", "#tree", "#-tree"}, false, "Output graph in tree format")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
flFilter := opts.NewListOpts(nil)
|
||||
cmd.Var(&flFilter, []string{"f", "-filter"}, "Provide filter values (i.e. 'dangling=true')")
|
||||
|
@ -1330,13 +1259,10 @@ func (cli *DockerCli) CmdImages(args ...string) error {
|
|||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
if cmd.NArg() > 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Consolidate all filter flags, and sanity check them early.
|
||||
// They'll get process in the daemon/server.
|
||||
|
@ -1559,7 +1485,6 @@ func (cli *DockerCli) CmdPs(args ...string) error {
|
|||
since := cmd.String([]string{"#sinceId", "#-since-id", "-since"}, "", "Show only containers created since Id or Name, include non-running ones.")
|
||||
before := cmd.String([]string{"#beforeId", "#-before-id", "-before"}, "", "Show only container created before Id or Name, include non-running ones.")
|
||||
last := cmd.Int([]string{"n"}, -1, "Show n last created containers, include non-running ones.")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
flFilter := opts.NewListOpts(nil)
|
||||
cmd.Var(&flFilter, []string{"f", "-filter"}, "Provide filter values. Valid filters:\nexited=<int> - containers with exit code of <int>")
|
||||
|
@ -1567,10 +1492,6 @@ func (cli *DockerCli) CmdPs(args ...string) error {
|
|||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
v := url.Values{}
|
||||
if *last == -1 && *nLatest {
|
||||
*last = 1
|
||||
|
@ -1683,14 +1604,9 @@ func (cli *DockerCli) CmdCommit(args ...string) error {
|
|||
flAuthor := cmd.String([]string{"a", "#author", "-author"}, "", "Author (e.g., \"John Hannibal Smith <hannibal@a-team.com>\")")
|
||||
// FIXME: --run is deprecated, it will be replaced with inline Dockerfile commands.
|
||||
flConfig := cmd.String([]string{"#run", "#-run"}, "", "This option is deprecated and will be removed in a future version in favor of inline Dockerfile-compatible commands")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
|
||||
var (
|
||||
name = cmd.Arg(0)
|
||||
|
@ -1746,19 +1662,14 @@ func (cli *DockerCli) CmdEvents(args ...string) error {
|
|||
cmd := cli.Subcmd("events", "[OPTIONS]", "Get real time events from the server")
|
||||
since := cmd.String([]string{"#since", "-since"}, "", "Show all events created since timestamp")
|
||||
until := cmd.String([]string{"-until"}, "", "Stream events until this timestamp")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
|
||||
if cmd.NArg() != 0 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(0) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var (
|
||||
v = url.Values{}
|
||||
loc = time.FixedZone(time.Now().Zone())
|
||||
|
@ -1788,18 +1699,14 @@ func (cli *DockerCli) CmdEvents(args ...string) error {
|
|||
|
||||
func (cli *DockerCli) CmdExport(args ...string) error {
|
||||
cmd := cli.Subcmd("export", "CONTAINER", "Export the contents of a filesystem as a tar archive to STDOUT")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
|
||||
if cmd.NArg() != 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if err := cli.stream("GET", "/containers/"+cmd.Arg(0)+"/export", nil, cli.out, nil); err != nil {
|
||||
return err
|
||||
|
@ -1809,18 +1716,13 @@ func (cli *DockerCli) CmdExport(args ...string) error {
|
|||
|
||||
func (cli *DockerCli) CmdDiff(args ...string) error {
|
||||
cmd := cli.Subcmd("diff", "CONTAINER", "Inspect changes on a container's filesystem")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
if cmd.NArg() != 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
body, _, err := readBody(cli.call("GET", "/containers/"+cmd.Arg(0)+"/changes", nil, false))
|
||||
|
||||
|
@ -1853,19 +1755,16 @@ func (cli *DockerCli) CmdLogs(args ...string) error {
|
|||
follow = cmd.Bool([]string{"f", "-follow"}, false, "Follow log output")
|
||||
times = cmd.Bool([]string{"t", "-timestamps"}, false, "Show timestamps")
|
||||
tail = cmd.String([]string{"-tail"}, "all", "Output the specified number of lines at the end of logs (defaults to all logs)")
|
||||
help = cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
)
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
|
||||
if cmd.NArg() != 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
name := cmd.Arg(0)
|
||||
|
||||
steam, _, err := cli.call("GET", "/containers/"+name+"/json", nil, false)
|
||||
|
@ -1899,19 +1798,16 @@ func (cli *DockerCli) CmdAttach(args ...string) error {
|
|||
cmd = cli.Subcmd("attach", "[OPTIONS] CONTAINER", "Attach to a running container")
|
||||
noStdin = cmd.Bool([]string{"#nostdin", "-no-stdin"}, false, "Do not attach STDIN")
|
||||
proxy = cmd.Bool([]string{"#sig-proxy", "-sig-proxy"}, true, "Proxy all received signals to the process (even in non-TTY mode). SIGCHLD, SIGKILL, and SIGSTOP are not proxied.")
|
||||
help = cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
)
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
|
||||
if cmd.NArg() != 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
name := cmd.Arg(0)
|
||||
|
||||
stream, _, err := cli.call("GET", "/containers/"+name+"/json", nil, false)
|
||||
|
@ -1977,18 +1873,13 @@ func (cli *DockerCli) CmdSearch(args ...string) error {
|
|||
trusted := cmd.Bool([]string{"#t", "#trusted", "#-trusted"}, false, "Only show trusted builds")
|
||||
automated := cmd.Bool([]string{"-automated"}, false, "Only show automated builds")
|
||||
stars := cmd.Int([]string{"s", "#stars", "-stars"}, 0, "Only displays with at least x stars")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
if cmd.NArg() != 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
v := url.Values{}
|
||||
v.Set("term", cmd.Arg(0))
|
||||
|
@ -2034,18 +1925,13 @@ type ports []int
|
|||
func (cli *DockerCli) CmdTag(args ...string) error {
|
||||
cmd := cli.Subcmd("tag", "[OPTIONS] IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]", "Tag an image into a repository")
|
||||
force := cmd.Bool([]string{"f", "#force", "-force"}, false, "Force")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
if cmd.NArg() != 2 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(2) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var (
|
||||
repository, tag = parsers.ParseRepositoryTag(cmd.Arg(1))
|
||||
|
@ -2110,11 +1996,6 @@ func (cli *DockerCli) CmdRun(args ...string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if config == nil {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
|
||||
if config.Image == "" {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
|
@ -2337,18 +2218,14 @@ func (cli *DockerCli) CmdRun(args ...string) error {
|
|||
|
||||
func (cli *DockerCli) CmdCp(args ...string) error {
|
||||
cmd := cli.Subcmd("cp", "CONTAINER:PATH HOSTPATH", "Copy files/folders from the PATH to the HOSTPATH")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return nil
|
||||
}
|
||||
if *help {
|
||||
|
||||
if cmd.NArg() != 2 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(2) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var copyData engine.Env
|
||||
info := strings.Split(cmd.Arg(0), ":")
|
||||
|
@ -2382,18 +2259,15 @@ func (cli *DockerCli) CmdCp(args ...string) error {
|
|||
func (cli *DockerCli) CmdSave(args ...string) error {
|
||||
cmd := cli.Subcmd("save", "IMAGE", "Save an image to a tar archive (streamed to STDOUT by default)")
|
||||
outfile := cmd.String([]string{"o", "-output"}, "", "Write to an file, instead of STDOUT")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
if *help {
|
||||
|
||||
if cmd.NArg() != 1 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var (
|
||||
output io.Writer = cli.out
|
||||
|
@ -2415,18 +2289,15 @@ func (cli *DockerCli) CmdSave(args ...string) error {
|
|||
func (cli *DockerCli) CmdLoad(args ...string) error {
|
||||
cmd := cli.Subcmd("load", "", "Load an image from a tar archive on STDIN")
|
||||
infile := cmd.String([]string{"i", "-input"}, "", "Read from a tar archive file, instead of STDIN")
|
||||
help := cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
return err
|
||||
}
|
||||
if *help {
|
||||
|
||||
if cmd.NArg() != 0 {
|
||||
cmd.Usage()
|
||||
return nil
|
||||
}
|
||||
if cmd.BadArgs(0) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var (
|
||||
input io.Reader = cli.in
|
||||
|
|
|
@ -26,7 +26,6 @@ var (
|
|||
flEnableCors = flag.Bool([]string{"#api-enable-cors", "-api-enable-cors"}, false, "Enable CORS headers in the remote API")
|
||||
flTls = flag.Bool([]string{"-tls"}, false, "Use TLS; implied by tls-verify flags")
|
||||
flTlsVerify = flag.Bool([]string{"-tlsverify"}, false, "Use TLS and verify the remote (daemon: verify client, client: verify daemon)")
|
||||
flHelp = flag.Bool([]string{"h", "-help"}, false, "Print usage")
|
||||
|
||||
// these are initialized in init() below since their default values depend on dockerCertPath which isn't fully initialized until init() runs
|
||||
flCa *string
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-attach - Attach to a running container
|
|||
|
||||
# SYNOPSIS
|
||||
**docker attach**
|
||||
[**--help**]/
|
||||
[**--no-stdin**[=*false*]]
|
||||
[**--sig-proxy**[=*true*]]
|
||||
CONTAINER
|
||||
|
@ -22,9 +21,6 @@ When you detach from a container the exit code will be returned to
|
|||
the client.
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**--no-stdin**=*true*|*false*
|
||||
Do not attach STDIN. The default is *false*.
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-build - Build a new image from the source code at PATH
|
|||
|
||||
# SYNOPSIS
|
||||
**docker build**
|
||||
[**--help**]
|
||||
[**--force-rm**[=*false*]]
|
||||
[**--no-cache**[=*false*]]
|
||||
[**-q**|**--quiet**[=*false*]]
|
||||
|
@ -37,9 +36,6 @@ as context.
|
|||
**--no-cache**=*true*|*false*
|
||||
Do not use cache when building the image. The default is *false*.
|
||||
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**-q**, **--quiet**=*true*|*false*
|
||||
Suppress the verbose output generated by the containers. The default is *false*.
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ docker-commit - Create a new image from a container's changes
|
|||
# SYNOPSIS
|
||||
**docker commit**
|
||||
[**-a**|**--author**[=*AUTHOR*]]
|
||||
[**--help**]
|
||||
[**-m**|**--message**[=*MESSAGE*]]
|
||||
[**-p**|**--pause**[=*true*]]
|
||||
CONTAINER [REPOSITORY[:TAG]]
|
||||
|
@ -19,9 +18,6 @@ Using an existing container's name or ID you can create a new image.
|
|||
**-a**, **--author**=""
|
||||
Author (e.g., "John Hannibal Smith <hannibal@a-team.com>")
|
||||
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**-m**, **--message**=""
|
||||
Commit message
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-cp - Copy files/folders from the PATH to the HOSTPATH
|
|||
|
||||
# SYNOPSIS
|
||||
**docker cp**
|
||||
[**--help**]
|
||||
CONTAINER:PATH HOSTPATH
|
||||
|
||||
# DESCRIPTION
|
||||
|
@ -15,8 +14,7 @@ path. Paths are relative to the root of the filesystem. Files
|
|||
can be copied from a running or stopped container.
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
There are no available options.
|
||||
|
||||
# EXAMPLES
|
||||
An important shell script file, created in a bash shell, is copied from
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-diff - Inspect changes on a container's filesystem
|
|||
|
||||
# SYNOPSIS
|
||||
**docker diff**
|
||||
[**--help**]
|
||||
CONTAINER
|
||||
|
||||
# DESCRIPTION
|
||||
|
@ -15,8 +14,7 @@ shortened container ID or the container name set using
|
|||
**docker run --name** option.
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
There are no available options.
|
||||
|
||||
# EXAMPLES
|
||||
Inspect the changes to on a nginx container:
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-events - Get real time events from the server
|
|||
|
||||
# SYNOPSIS
|
||||
**docker events**
|
||||
[**--help**]
|
||||
[**--since**[=*SINCE*]]
|
||||
[**--until**[=*UNTIL*]]
|
||||
|
||||
|
@ -16,9 +15,6 @@ Get event information from the Docker daemon. Information can include historical
|
|||
information and real-time information.
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**--since**=""
|
||||
Show all events created since timestamp
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-export - Export the contents of a filesystem as a tar archive to STDOUT
|
|||
|
||||
# SYNOPSIS
|
||||
**docker export**
|
||||
[**--help**]
|
||||
CONTAINER
|
||||
|
||||
# DESCRIPTION
|
||||
|
@ -15,8 +14,7 @@ container ID or container name. The output is exported to STDOUT and can be
|
|||
redirected to a tar file.
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
There are no available options.
|
||||
|
||||
# EXAMPLES
|
||||
Export the contents of the container called angry_bell to a tar file
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-history - Show the history of an image
|
|||
|
||||
# SYNOPSIS
|
||||
**docker history**
|
||||
[**--help**]
|
||||
[**--no-trunc**[=*false*]]
|
||||
[**-q**|**--quiet**[=*false*]]
|
||||
IMAGE
|
||||
|
@ -16,9 +15,6 @@ docker-history - Show the history of an image
|
|||
Show the history of when and how an image was created.
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**--no-trunc**=*true*|*false*
|
||||
Don't truncate output. The default is *false*.
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-images - List images
|
|||
|
||||
# SYNOPSIS
|
||||
**docker images**
|
||||
[**--help**]
|
||||
[**-a**|**--all**[=*false*]]
|
||||
[**-f**|**--filter**[=*[]*]]
|
||||
[**--no-trunc**[=*false*]]
|
||||
|
@ -36,9 +35,6 @@ versions.
|
|||
**-f**, **--filter**=[]
|
||||
Provide filter values (i.e. 'dangling=true')
|
||||
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**--no-trunc**=*true*|*false*
|
||||
Don't truncate output. The default is *false*.
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-import - Create an empty filesystem image and import the contents of the
|
|||
|
||||
# SYNOPSIS
|
||||
**docker import**
|
||||
[**--help**]
|
||||
URL|- [REPOSITORY[:TAG]]
|
||||
|
||||
# DESCRIPTION
|
||||
|
@ -14,8 +13,7 @@ Create a new filesystem image from the contents of a tarball (`.tar`,
|
|||
`.tar.gz`, `.tgz`, `.bzip`, `.tar.xz`, `.txz`) into it, then optionally tag it.
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
There are no available options.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-info - Display system-wide information
|
|||
|
||||
# SYNOPSIS
|
||||
**docker info**
|
||||
[**--help**]
|
||||
|
||||
|
||||
# DESCRIPTION
|
||||
|
@ -21,8 +20,7 @@ allocates a certain amount of data space and meta data space from the space
|
|||
available on the volume where `/var/lib/docker` is mounted.
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
There are no available options.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-inspect - Return low-level information on a container or image
|
|||
|
||||
# SYNOPSIS
|
||||
**docker inspect**
|
||||
[**--help**]
|
||||
[**-f**|**--format**[=*FORMAT*]]
|
||||
CONTAINER|IMAGE [CONTAINER|IMAGE...]
|
||||
|
||||
|
@ -18,9 +17,6 @@ array. If a format is specified, the given template will be executed for
|
|||
each result.
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**-f**, **--format**=""
|
||||
Format the output using the given go template.
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-kill - Kill a running container using SIGKILL or a specified signal
|
|||
|
||||
# SYNOPSIS
|
||||
**docker kill**
|
||||
[**--help**]
|
||||
[**-s**|**--signal**[=*"KILL"*]]
|
||||
CONTAINER [CONTAINER...]
|
||||
|
||||
|
@ -16,9 +15,6 @@ The main process inside each container specified will be sent SIGKILL,
|
|||
or any signal specified with option --signal.
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**-s**, **--signal**="KILL"
|
||||
Signal to send to the container
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-load - Load an image from a tar archive on STDIN
|
|||
|
||||
# SYNOPSIS
|
||||
**docker load**
|
||||
[**--help**]
|
||||
[**-i**|**--input**[=*INPUT*]]
|
||||
|
||||
|
||||
|
@ -16,9 +15,6 @@ Loads a tarred repository from a file or the standard input stream.
|
|||
Restores both images and tags.
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**-i**, **--input**=""
|
||||
Read from a tar archive file, instead of STDIN
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ docker-login - Register or log in to a Docker registry server, if no server is s
|
|||
# SYNOPSIS
|
||||
**docker login**
|
||||
[**-e**|**--email**[=*EMAIL*]]
|
||||
[**--help**]
|
||||
[**-p**|**--password**[=*PASSWORD*]]
|
||||
[**-u**|**--username**[=*USERNAME*]]
|
||||
[SERVER]
|
||||
|
@ -21,9 +20,6 @@ login to a private registry you can specify this by adding the server name.
|
|||
**-e**, **--email**=""
|
||||
Email
|
||||
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**-p**, **--password**=""
|
||||
Password
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ docker-logs - Fetch the logs of a container
|
|||
# SYNOPSIS
|
||||
**docker logs**
|
||||
[**-f**|**--follow**[=*false*]]
|
||||
[**--help**]
|
||||
[**-t**|**--timestamps**[=*false*]]
|
||||
[**--tail**[=*"all"*]]
|
||||
CONTAINER
|
||||
|
@ -23,9 +22,6 @@ The **docker logs --follow** command combines commands **docker logs** and
|
|||
then continue streaming new output from the container’s stdout and stderr.
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**-f**, **--follow**=*true*|*false*
|
||||
Follow log output. The default is *false*.
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-port - Lookup the public-facing port that is NAT-ed to PRIVATE_PORT
|
|||
|
||||
# SYNOPSIS
|
||||
**docker port**
|
||||
[**--help**]
|
||||
CONTAINER PRIVATE_PORT
|
||||
|
||||
# OPTIONS
|
||||
|
|
|
@ -8,7 +8,6 @@ docker-ps - List containers
|
|||
**docker ps**
|
||||
[**-a**|**--all**[=*false*]]
|
||||
[**--before**[=*BEFORE*]]
|
||||
[**--help**]
|
||||
[**-f**|**--filter**[=*[]*]]
|
||||
[**-l**|**--latest**[=*false*]]
|
||||
[**-n**[=*-1*]]
|
||||
|
@ -30,9 +29,6 @@ the running containers.
|
|||
**--before**=""
|
||||
Show only container created before Id or Name, include non-running ones.
|
||||
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**-f**, **--filter**=[]
|
||||
Provide filter values. Valid filters:
|
||||
exited=<int> - containers with exit code of <int>
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-pull - Pull an image or a repository from the registry
|
|||
|
||||
# SYNOPSIS
|
||||
**docker pull**
|
||||
[**--help**]
|
||||
NAME[:TAG]
|
||||
|
||||
# DESCRIPTION
|
||||
|
@ -17,10 +16,9 @@ images for that repository name are pulled down including any tags.
|
|||
It is also possible to specify a non-default registry to pull from.
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
There are no available options.
|
||||
|
||||
# EXAMPLE
|
||||
# EXAMPLES
|
||||
|
||||
# Pull a repository with multiple images
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-push - Push an image or a repository to the registry
|
|||
|
||||
# SYNOPSIS
|
||||
**docker push**
|
||||
[**--help**]
|
||||
NAME[:TAG]
|
||||
|
||||
# DESCRIPTION
|
||||
|
@ -16,8 +15,7 @@ image can be pushed to another, perhaps private, registry as demonstrated in
|
|||
the example below.
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
There are no available options.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-restart - Restart a running container
|
|||
|
||||
# SYNOPSIS
|
||||
**docker restart**
|
||||
[**--help**]
|
||||
[**-t**|**--time**[=*10*]]
|
||||
CONTAINER [CONTAINER...]
|
||||
|
||||
|
@ -14,9 +13,6 @@ docker-restart - Restart a running container
|
|||
Restart each container listed.
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**-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.
|
||||
|
||||
|
|
|
@ -19,9 +19,6 @@ remove a running container unless you use the \fB-f\fR option. To see all
|
|||
containers on a host use the **docker ps -a** command.
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**-f**, **--force**=*true*|*false*
|
||||
Force the removal of a running container (uses SIGKILL). The default is *false*.
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ docker-rmi - Remove one or more images
|
|||
# SYNOPSIS
|
||||
**docker rmi**
|
||||
[**-f**|**--force**[=*false*]]
|
||||
[**--help**]
|
||||
[**--no-prune**[=*false*]]
|
||||
IMAGE [IMAGE...]
|
||||
|
||||
|
@ -22,9 +21,6 @@ use the **docker images** command.
|
|||
**-f**, **--force**=*true*|*false*
|
||||
Force removal of the image. The default is *false*.
|
||||
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**--no-prune**=*true*|*false*
|
||||
Do not delete untagged parents. The default is *false*.
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ docker-run - Run a command in a new container
|
|||
[**--env-file**[=*[]*]]
|
||||
[**--expose**[=*[]*]]
|
||||
[**-h**|**--hostname**[=*HOSTNAME*]]
|
||||
[**--help**]
|
||||
[**-i**|**--interactive**[=*false*]]
|
||||
[**--link**[=*[]*]]
|
||||
[**--lxc-conf**[=*[]*]]
|
||||
|
@ -133,9 +132,6 @@ developer can expose the port using the EXPOSE parameter of the Dockerfile, 2)
|
|||
the operator can use the **--expose** option with **docker run**, or 3) the
|
||||
container can be started with the **--link**.
|
||||
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**-h**, **--hostname**=*hostname*
|
||||
Sets the container host name that is available inside the container.
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-save - Save an image to a tar archive (streamed to STDOUT by default)
|
|||
|
||||
# SYNOPSIS
|
||||
**docker save**
|
||||
[**--help**]
|
||||
[**-o**|**--output**[=*OUTPUT*]]
|
||||
IMAGE
|
||||
|
||||
|
@ -17,9 +16,6 @@ parent layers, and all tags + versions, or specified repo:tag.
|
|||
Stream to a file instead of STDOUT by using **-o**.
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**-o**, **--output**=""
|
||||
Write to an file, instead of STDOUT
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ docker-search - Search the Docker Hub for images
|
|||
# SYNOPSIS
|
||||
**docker search**
|
||||
[**--automated**[=*false*]]
|
||||
[**--help**]
|
||||
[**--no-trunc**[=*false*]]
|
||||
[**-s**|**--stars**[=*0*]]
|
||||
TERM
|
||||
|
@ -23,9 +22,6 @@ is automated.
|
|||
**--automated**=*true*|*false*
|
||||
Only show automated builds. The default is *false*.
|
||||
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**--no-trunc**=*true*|*false*
|
||||
Don't truncate output. The default is *false*.
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ docker-start - Restart a stopped container
|
|||
# SYNOPSIS
|
||||
**docker start**
|
||||
[**-a**|**--attach**[=*false*]]
|
||||
[**--help**]
|
||||
[**-i**|**--interactive**[=*false*]]
|
||||
CONTAINER [CONTAINER...]
|
||||
|
||||
|
@ -19,9 +18,6 @@ Start a stopped container.
|
|||
**-a**, **--attach**=*true*|*false*
|
||||
Attach container's STDOUT and STDERR and forward all signals to the process. The default is *false*.
|
||||
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**-i**, **--interactive**=*true*|*false*
|
||||
Attach container's STDIN. The default is *false*.
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-stop - Stop a running container by sending SIGTERM and then SIGKILL after
|
|||
|
||||
# SYNOPSIS
|
||||
**docker stop**
|
||||
[**--help**]
|
||||
[**-t**|**--time**[=*10*]]
|
||||
CONTAINER [CONTAINER...]
|
||||
|
||||
|
@ -15,9 +14,6 @@ Stop a running container (Send SIGTERM, and then SIGKILL after
|
|||
grace period)
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**-t**, **--time**=10
|
||||
Number of seconds to wait for the container to stop before killing it. Default is 10 seconds.
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ docker-tag - Tag an image into a repository
|
|||
# SYNOPSIS
|
||||
**docker tag**
|
||||
[**-f**|**--force**[=*false*]]
|
||||
[**--help**]
|
||||
IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]
|
||||
|
||||
# DESCRIPTION
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-top - Display the running processes of a container
|
|||
|
||||
# SYNOPSIS
|
||||
**docker top**
|
||||
[**--help**]
|
||||
CONTAINER [ps OPTIONS]
|
||||
|
||||
# DESCRIPTION
|
||||
|
@ -15,8 +14,7 @@ Look up the running process of the container. ps-OPTION can be any of the
|
|||
options you would pass to a Linux ps command.
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
There are no available options.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ docker-wait - Block until a container stops, then print its exit code.
|
|||
|
||||
# SYNOPSIS
|
||||
**docker wait**
|
||||
[**--help**]
|
||||
CONTAINER [CONTAINER...]
|
||||
|
||||
# DESCRIPTION
|
||||
|
@ -14,8 +13,7 @@ CONTAINER [CONTAINER...]
|
|||
Block until a container stops, then print its exit code.
|
||||
|
||||
# OPTIONS
|
||||
**--help**
|
||||
Print usage statement
|
||||
There are no available options.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
|
|
|
@ -26,9 +26,6 @@ To see the man page for a command run **man docker <command>**.
|
|||
**-D**=*true*|*false*
|
||||
Enable debug mode. Default is false.
|
||||
|
||||
**--help**
|
||||
Print usage statement
|
||||
|
||||
**-H**, **--host**=[unix:///var/run/docker.sock]: tcp://[host:port] to bind or
|
||||
unix://[/path/to/socket] to use.
|
||||
The socket(s) to bind to in daemon mode specified using one or more
|
||||
|
|
|
@ -15,19 +15,6 @@ or execute `docker help`:
|
|||
|
||||
...
|
||||
|
||||
## Help
|
||||
To list the help on any command just execute the command, followed by the `--help` option.
|
||||
|
||||
$ sudo docker run --help
|
||||
|
||||
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
|
||||
|
||||
Run a command in a new container
|
||||
|
||||
-a, --attach=[] Attach to STDIN, STDOUT or STDERR.
|
||||
-c, --cpu-shares=0 CPU shares (relative weight)
|
||||
...
|
||||
|
||||
## Option types
|
||||
|
||||
Single character commandline options can be combined, so rather than
|
||||
|
|
|
@ -395,19 +395,6 @@ func Lookup(name string) *Flag {
|
|||
return CommandLine.formal[name]
|
||||
}
|
||||
|
||||
func (f *FlagSet) BadArgs(nargs int) bool {
|
||||
if NArg() < nargs {
|
||||
fmt.Fprintf(f.out(), "docker: '%s' requires arguments. See 'docker %s --help'.\n", f.name, f.name)
|
||||
return true
|
||||
} else {
|
||||
if nargs == 0 && NArg() != 0 {
|
||||
fmt.Fprintf(f.out(), "docker: '%s' does not require arguments. See 'docker %s --help'.\n", f.name, f.name)
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Set sets the value of the named flag.
|
||||
func (f *FlagSet) Set(name, value string) error {
|
||||
flag, ok := f.formal[name]
|
||||
|
@ -481,7 +468,7 @@ func defaultUsage(f *FlagSet) {
|
|||
// Usage prints to standard error a usage message documenting all defined command-line flags.
|
||||
// The function is a variable that may be changed to point to a custom function.
|
||||
var Usage = func() {
|
||||
fmt.Fprintf(CommandLine.output, "Usage of %s:\n", os.Args[0])
|
||||
fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
|
||||
PrintDefaults()
|
||||
}
|
||||
|
||||
|
@ -770,7 +757,7 @@ func Var(value Value, names []string, usage string) {
|
|||
func (f *FlagSet) failf(format string, a ...interface{}) error {
|
||||
err := fmt.Errorf(format, a...)
|
||||
fmt.Fprintln(f.out(), err)
|
||||
fmt.Fprintf(f.out(), "See 'docker %s --help'.\n", f.name)
|
||||
f.usage()
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package runconfig
|
|||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -76,8 +75,6 @@ func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf
|
|||
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[:max-retry], always)")
|
||||
// For documentation purpose
|
||||
help = cmd.Bool([]string{"#help", "-help"}, false, "Print usage")
|
||||
|
||||
_ = 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")
|
||||
)
|
||||
|
@ -169,14 +166,9 @@ func parseRun(cmd *flag.FlagSet, args []string, sysInfo *sysinfo.SysInfo) (*Conf
|
|||
entrypoint []string
|
||||
image string
|
||||
)
|
||||
|
||||
if *help {
|
||||
return nil, nil, cmd, nil
|
||||
if len(parsedArgs) >= 1 {
|
||||
image = cmd.Arg(0)
|
||||
}
|
||||
if cmd.BadArgs(1) {
|
||||
os.Exit(1)
|
||||
}
|
||||
image = cmd.Arg(0)
|
||||
if len(parsedArgs) > 1 {
|
||||
runCmd = parsedArgs[1:]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue