From 79cf8395277002011b7632e5a040d4f4a7a25d1f Mon Sep 17 00:00:00 2001 From: Lei Jitang Date: Tue, 26 Aug 2014 14:04:57 +0800 Subject: [PATCH 1/2] Fix the bug of docker import command when import a image with a tag use format 'URL|- [REPOSITORY[:TAG]]'.Fixes #7714 Signed-off-by: Lei Jitang --- api/client/commands.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/client/commands.go b/api/client/commands.go index 81b0668cd..29dbbc729 100644 --- a/api/client/commands.go +++ b/api/client/commands.go @@ -1101,7 +1101,8 @@ func (cli *DockerCli) CmdImport(args ...string) error { if repository != "" { //Check if the given image name can be resolved - if _, _, err := registry.ResolveRepositoryName(repository); err != nil { + repo, _ := parsers.ParseRepositoryTag(repository) + if _, _, err := registry.ResolveRepositoryName(repo); err != nil { return err } } From 7e72ed70f9cac871b845bebef0f96178c0f1a25c Mon Sep 17 00:00:00 2001 From: Lei Jitang Date: Tue, 26 Aug 2014 15:03:38 +0800 Subject: [PATCH 2/2] add docker import test with a tag. Fixes #7714 Signed-off-by: Lei Jitang --- integration-cli/docker_cli_export_import_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-cli/docker_cli_export_import_test.go b/integration-cli/docker_cli_export_import_test.go index 2e443cd39..b044cd836 100644 --- a/integration-cli/docker_cli_export_import_test.go +++ b/integration-cli/docker_cli_export_import_test.go @@ -29,7 +29,7 @@ func TestExportContainerAndImportImage(t *testing.T) { out, _, err = runCommandWithOutput(exportCmd) errorOut(err, t, fmt.Sprintf("failed to export container: %v %v", out, err)) - importCmdFinal := `cat /tmp/testexp.tar | docker import - testexp` + importCmdFinal := `cat /tmp/testexp.tar | docker import - repo/testexp:v1` importCmd := exec.Command("bash", "-c", importCmdFinal) out, _, err = runCommandWithOutput(importCmd) errorOut(err, t, fmt.Sprintf("failed to import image: %v %v", out, err)) @@ -41,7 +41,7 @@ func TestExportContainerAndImportImage(t *testing.T) { errorOut(err, t, fmt.Sprintf("output should've been an image id: %v %v", out, err)) deleteContainer(cleanedContainerID) - deleteImages("testexp") + deleteImages("repo/testexp:v1") os.Remove("/tmp/testexp.tar")