2015-03-24 23:57:23 -04:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
2016-03-16 15:19:22 -04:00
|
|
|
"golang.org/x/net/context"
|
|
|
|
|
2015-05-05 00:18:28 -04:00
|
|
|
Cli "github.com/docker/docker/cli"
|
2015-03-24 23:57:23 -04:00
|
|
|
flag "github.com/docker/docker/pkg/mflag"
|
2016-01-04 19:05:26 -05:00
|
|
|
"github.com/docker/engine-api/types"
|
2015-03-24 23:57:23 -04:00
|
|
|
)
|
|
|
|
|
2015-03-25 13:34:41 -04:00
|
|
|
// CmdTag tags an image into a repository.
|
|
|
|
//
|
|
|
|
// Usage: docker tag [OPTIONS] IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]
|
2015-03-24 23:57:23 -04:00
|
|
|
func (cli *DockerCli) CmdTag(args ...string) error {
|
2015-10-08 08:46:21 -04:00
|
|
|
cmd := Cli.Subcmd("tag", []string{"IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]"}, Cli.DockerCommands["tag"].Description, true)
|
2015-12-01 17:02:02 -05:00
|
|
|
force := cmd.Bool([]string{"#f", "#-force"}, false, "Force the tagging even if there's a conflict")
|
2015-03-24 23:57:23 -04:00
|
|
|
cmd.Require(flag.Exact, 2)
|
|
|
|
|
2015-03-28 21:22:46 -04:00
|
|
|
cmd.ParseFlags(args, true)
|
2015-03-24 23:57:23 -04:00
|
|
|
|
2015-12-04 17:02:06 -05:00
|
|
|
options := types.ImageTagOptions{
|
2016-04-13 04:33:46 -04:00
|
|
|
Force: *force,
|
2015-03-24 23:57:23 -04:00
|
|
|
}
|
|
|
|
|
2016-04-13 04:33:46 -04:00
|
|
|
return cli.client.ImageTag(context.Background(), cmd.Arg(0), cmd.Arg(1), options)
|
2015-03-24 23:57:23 -04:00
|
|
|
}
|