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 <yong.tang.github@outlook.com>
This commit is contained in:
parent
1dab9af5d5
commit
4455ec14b8
6 changed files with 6 additions and 29 deletions
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue