From 4455ec14b87d5ad474c5e11d60907bceb35e9e09 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Sun, 29 May 2016 08:16:39 -0700 Subject: [PATCH] Remove deprecated -f flag on docker tag The -f flag on docker tag has been deprecated in docker 1.10 and is expected to be removed in docker 1.12. This fix removed the -f flag on docker tag and also updated deprecated.md. NOTE: A separate pull request for engine-api has been opened to cover the related changes. Signed-off-by: Yong Tang --- api/client/tag.go | 8 +------- api/client/trust.go | 6 +----- docs/deprecated.md | 4 ++-- integration-cli/docker_cli_images_test.go | 2 +- integration-cli/docker_cli_ps_test.go | 2 +- integration-cli/docker_cli_tag_test.go | 13 ------------- 6 files changed, 6 insertions(+), 29 deletions(-) diff --git a/api/client/tag.go b/api/client/tag.go index 21fe92a5f2..0b6a073ccb 100644 --- a/api/client/tag.go +++ b/api/client/tag.go @@ -5,7 +5,6 @@ import ( Cli "github.com/docker/docker/cli" flag "github.com/docker/docker/pkg/mflag" - "github.com/docker/engine-api/types" ) // CmdTag tags an image into a repository. @@ -13,14 +12,9 @@ import ( // Usage: docker tag [OPTIONS] IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG] func (cli *DockerCli) CmdTag(args ...string) error { cmd := Cli.Subcmd("tag", []string{"IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]"}, Cli.DockerCommands["tag"].Description, true) - force := cmd.Bool([]string{"#f", "#-force"}, false, "Force the tagging even if there's a conflict") cmd.Require(flag.Exact, 2) cmd.ParseFlags(args, true) - options := types.ImageTagOptions{ - Force: *force, - } - - return cli.client.ImageTag(context.Background(), cmd.Arg(0), cmd.Arg(1), options) + return cli.client.ImageTag(context.Background(), cmd.Arg(0), cmd.Arg(1)) } diff --git a/api/client/trust.go b/api/client/trust.go index 987a050989..3a0f334c89 100644 --- a/api/client/trust.go +++ b/api/client/trust.go @@ -265,11 +265,7 @@ func (cli *DockerCli) trustedReference(ctx context.Context, ref reference.NamedT func (cli *DockerCli) tagTrusted(ctx context.Context, trustedRef reference.Canonical, ref reference.NamedTagged) error { fmt.Fprintf(cli.out, "Tagging %s as %s\n", trustedRef.String(), ref.String()) - options := types.ImageTagOptions{ - Force: true, - } - - return cli.client.ImageTag(ctx, trustedRef.String(), ref.String(), options) + return cli.client.ImageTag(ctx, trustedRef.String(), ref.String()) } func notaryError(repoName string, err error) error { diff --git a/docs/deprecated.md b/docs/deprecated.md index a919a5d54f..9de65b28c2 100644 --- a/docs/deprecated.md +++ b/docs/deprecated.md @@ -35,9 +35,9 @@ The fields `ID`, `Status` and `From` in the events API have been deprecated in f See the events API documentation for the new format. ### `-f` flag on `docker tag` -**Deprecated In Release: v1.10** +**Deprecated In Release: [v1.10.0](https://github.com/docker/docker/releases/tag/v1.10.0)** -**Target For Removal In Release: v1.12** +**Removed In Release: v1.12.0** To make tagging consistent across the various `docker` commands, the `-f` flag on the `docker tag` command is deprecated. It is not longer necessary to specify `-f` to move a tag from one image to another. Nor will `docker` generate an error if the `-f` flag is missing and the specified tag is already in use. diff --git a/integration-cli/docker_cli_images_test.go b/integration-cli/docker_cli_images_test.go index 7d390699db..904f380fd3 100644 --- a/integration-cli/docker_cli_images_test.go +++ b/integration-cli/docker_cli_images_test.go @@ -240,7 +240,7 @@ func (s *DockerSuite) TestImagesEnsureDanglingImageOnlyListedOnce(c *check.C) { imageID := stringid.TruncateID(strings.TrimSpace(out)) // overwrite the tag, making the previous image dangling - dockerCmd(c, "tag", "-f", "busybox", "foobox") + dockerCmd(c, "tag", "busybox", "foobox") out, _ = dockerCmd(c, "images", "-q", "-f", "dangling=true") // Expect one dangling image diff --git a/integration-cli/docker_cli_ps_test.go b/integration-cli/docker_cli_ps_test.go index d635993d61..3fe8ecf96e 100644 --- a/integration-cli/docker_cli_ps_test.go +++ b/integration-cli/docker_cli_ps_test.go @@ -658,7 +658,7 @@ func (s *DockerSuite) TestPsImageIDAfterUpdate(c *check.C) { out, _, err = runCommandWithOutput(runCmd) c.Assert(err, checker.IsNil) - runCmd = exec.Command(dockerBinary, "tag", "-f", updatedImageName, originalImageName) + runCmd = exec.Command(dockerBinary, "tag", updatedImageName, originalImageName) out, _, err = runCommandWithOutput(runCmd) c.Assert(err, checker.IsNil) diff --git a/integration-cli/docker_cli_tag_test.go b/integration-cli/docker_cli_tag_test.go index e3c6c767b1..b7d2b1dfe6 100644 --- a/integration-cli/docker_cli_tag_test.go +++ b/integration-cli/docker_cli_tag_test.go @@ -86,19 +86,6 @@ func (s *DockerSuite) TestTagExistedNameWithoutForce(c *check.C) { dockerCmd(c, "tag", "busybox:latest", "busybox:test") } -// tag an image with an existed tag name with -f option should work -func (s *DockerSuite) TestTagExistedNameWithForce(c *check.C) { - // Don't attempt to pull on Windows as not in hub. It's installed - // as an image through .ensure-frozen-images-windows - if daemonPlatform != "windows" { - if err := pullImageIfNotExist("busybox:latest"); err != nil { - c.Fatal("couldn't find the busybox:latest image locally and failed to pull it") - } - } - dockerCmd(c, "tag", "busybox:latest", "busybox:test") - dockerCmd(c, "tag", "-f", "busybox:latest", "busybox:test") -} - func (s *DockerSuite) TestTagWithPrefixHyphen(c *check.C) { // Don't attempt to pull on Windows as not in hub. It's installed // as an image through .ensure-frozen-images-windows