Merge pull request #7716 from coolljt0725/master
Fix the bug of docker import command when import a image with a tag use format 'URL|- [REPOSITORY[:TAG]]'
This commit is contained in:
commit
7556a42453
2 changed files with 4 additions and 3 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
|
Loading…
Reference in a new issue