spotify / docker-maven-plugin

INACTIVE: A maven plugin for Docker
Apache License 2.0
2.67k stars 575 forks source link

'Image already exists' fails the push #258

Closed hzywind closed 8 years ago

hzywind commented 8 years ago

Description

If an image already exists in the registry, the 'push' fails due to 'Image already exists' and results in retry pushing and finally a maven build failure.

d1358d793d2f: Pushed dc13f11841f7: Pushed 70fa39f3c5b1: Pushed b00ca73cbdde: Pushed 2e82ca87ee2d: Image already exists 3667a1481f9c: Image already exists 401f6712926f: Image already exists b6b59ba2b1e5: Image already exists 1.0-SNAPSHOT: digest: sha256:3bd8dddf8429c68f111dad7d51d3b23f37ead8f36c053f31bca340c39449c314 size: 11230 [WARNING] Failed to push xxxx/reactor-zookeeper:1.0-SNAPSHOT, retrying in 10 seconds (1/5).

How to reproduce

Repeatedly run a same maven job to push.

What do you expect

'Image already exists' should be a warning. It should not fail the maven job.

What happened instead

It fails the maven job

Software:

mattnworb commented 8 years ago

I think that "image already exists" is a red herring and not the true reason why your image failed to push. What output do you see if you let the retry loop run until completion? Please run your build with -e and attach the output.

hzywind commented 8 years ago

Sorry I cannot reproduce it anymore. I guess the problem is related to the the repository server since it seems have been patched. Anyway it runs very well now. I will close this entry now. Thank you.

NancyChunlan commented 7 years ago

We met similar issue. The error said 'cannot temporarily tag while target image already exist.' And after checked, found the code as below:

      if (!name.hasRegistry() && registry != null) {
            if (hasImage(targetImage)) {
                throw new DockerAccessException(
                    String.format("Cannot temporarily tag %s with %s because target image already exists. " +
                                  "Please remove this and retry.",
                                  name.getFullName(), targetImage));
            }

I guess it's abnormal to interrupt the docker push in this way. Is it possible to remove the exception? Or maybe add a parameter to toggle on/off the exception? Thanks.

NancyChunlan commented 7 years ago

By the way, we can fix the issue by remove the existing tags. But it's not a good way for us to do that.