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 <yong.tang.github@outlook.com>
| ... | ... |
@@ -5,7 +5,6 @@ import ( |
| 5 | 5 |
|
| 6 | 6 |
Cli "github.com/docker/docker/cli" |
| 7 | 7 |
flag "github.com/docker/docker/pkg/mflag" |
| 8 |
- "github.com/docker/engine-api/types" |
|
| 9 | 8 |
) |
| 10 | 9 |
|
| 11 | 10 |
// CmdTag tags an image into a repository. |
| ... | ... |
@@ -13,14 +12,9 @@ import ( |
| 13 | 13 |
// Usage: docker tag [OPTIONS] IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG] |
| 14 | 14 |
func (cli *DockerCli) CmdTag(args ...string) error {
|
| 15 | 15 |
cmd := Cli.Subcmd("tag", []string{"IMAGE[:TAG] [REGISTRYHOST/][USERNAME/]NAME[:TAG]"}, Cli.DockerCommands["tag"].Description, true)
|
| 16 |
- force := cmd.Bool([]string{"#f", "#-force"}, false, "Force the tagging even if there's a conflict")
|
|
| 17 | 16 |
cmd.Require(flag.Exact, 2) |
| 18 | 17 |
|
| 19 | 18 |
cmd.ParseFlags(args, true) |
| 20 | 19 |
|
| 21 |
- options := types.ImageTagOptions{
|
|
| 22 |
- Force: *force, |
|
| 23 |
- } |
|
| 24 |
- |
|
| 25 |
- return cli.client.ImageTag(context.Background(), cmd.Arg(0), cmd.Arg(1), options) |
|
| 20 |
+ return cli.client.ImageTag(context.Background(), cmd.Arg(0), cmd.Arg(1)) |
|
| 26 | 21 |
} |
| ... | ... |
@@ -265,11 +265,7 @@ func (cli *DockerCli) trustedReference(ctx context.Context, ref reference.NamedT |
| 265 | 265 |
func (cli *DockerCli) tagTrusted(ctx context.Context, trustedRef reference.Canonical, ref reference.NamedTagged) error {
|
| 266 | 266 |
fmt.Fprintf(cli.out, "Tagging %s as %s\n", trustedRef.String(), ref.String()) |
| 267 | 267 |
|
| 268 |
- options := types.ImageTagOptions{
|
|
| 269 |
- Force: true, |
|
| 270 |
- } |
|
| 271 |
- |
|
| 272 |
- return cli.client.ImageTag(ctx, trustedRef.String(), ref.String(), options) |
|
| 268 |
+ return cli.client.ImageTag(ctx, trustedRef.String(), ref.String()) |
|
| 273 | 269 |
} |
| 274 | 270 |
|
| 275 | 271 |
func notaryError(repoName string, err error) error {
|
| ... | ... |
@@ -35,9 +35,9 @@ The fields `ID`, `Status` and `From` in the events API have been deprecated in f |
| 35 | 35 |
See the events API documentation for the new format. |
| 36 | 36 |
|
| 37 | 37 |
### `-f` flag on `docker tag` |
| 38 |
-**Deprecated In Release: v1.10** |
|
| 38 |
+**Deprecated In Release: [v1.10.0](https://github.com/docker/docker/releases/tag/v1.10.0)** |
|
| 39 | 39 |
|
| 40 |
-**Target For Removal In Release: v1.12** |
|
| 40 |
+**Removed In Release: v1.12.0** |
|
| 41 | 41 |
|
| 42 | 42 |
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. |
| 43 | 43 |
|
| ... | ... |
@@ -240,7 +240,7 @@ func (s *DockerSuite) TestImagesEnsureDanglingImageOnlyListedOnce(c *check.C) {
|
| 240 | 240 |
imageID := stringid.TruncateID(strings.TrimSpace(out)) |
| 241 | 241 |
|
| 242 | 242 |
// overwrite the tag, making the previous image dangling |
| 243 |
- dockerCmd(c, "tag", "-f", "busybox", "foobox") |
|
| 243 |
+ dockerCmd(c, "tag", "busybox", "foobox") |
|
| 244 | 244 |
|
| 245 | 245 |
out, _ = dockerCmd(c, "images", "-q", "-f", "dangling=true") |
| 246 | 246 |
// Expect one dangling image |
| ... | ... |
@@ -658,7 +658,7 @@ func (s *DockerSuite) TestPsImageIDAfterUpdate(c *check.C) {
|
| 658 | 658 |
out, _, err = runCommandWithOutput(runCmd) |
| 659 | 659 |
c.Assert(err, checker.IsNil) |
| 660 | 660 |
|
| 661 |
- runCmd = exec.Command(dockerBinary, "tag", "-f", updatedImageName, originalImageName) |
|
| 661 |
+ runCmd = exec.Command(dockerBinary, "tag", updatedImageName, originalImageName) |
|
| 662 | 662 |
out, _, err = runCommandWithOutput(runCmd) |
| 663 | 663 |
c.Assert(err, checker.IsNil) |
| 664 | 664 |
|
| ... | ... |
@@ -86,19 +86,6 @@ func (s *DockerSuite) TestTagExistedNameWithoutForce(c *check.C) {
|
| 86 | 86 |
dockerCmd(c, "tag", "busybox:latest", "busybox:test") |
| 87 | 87 |
} |
| 88 | 88 |
|
| 89 |
-// tag an image with an existed tag name with -f option should work |
|
| 90 |
-func (s *DockerSuite) TestTagExistedNameWithForce(c *check.C) {
|
|
| 91 |
- // Don't attempt to pull on Windows as not in hub. It's installed |
|
| 92 |
- // as an image through .ensure-frozen-images-windows |
|
| 93 |
- if daemonPlatform != "windows" {
|
|
| 94 |
- if err := pullImageIfNotExist("busybox:latest"); err != nil {
|
|
| 95 |
- c.Fatal("couldn't find the busybox:latest image locally and failed to pull it")
|
|
| 96 |
- } |
|
| 97 |
- } |
|
| 98 |
- dockerCmd(c, "tag", "busybox:latest", "busybox:test") |
|
| 99 |
- dockerCmd(c, "tag", "-f", "busybox:latest", "busybox:test") |
|
| 100 |
-} |
|
| 101 |
- |
|
| 102 | 89 |
func (s *DockerSuite) TestTagWithPrefixHyphen(c *check.C) {
|
| 103 | 90 |
// Don't attempt to pull on Windows as not in hub. It's installed |
| 104 | 91 |
// as an image through .ensure-frozen-images-windows |