Docker-maven-plugin: Cannot temporarily tag because target image already exists

Created on 14 Aug 2017  路  17Comments  路  Source: fabric8io/docker-maven-plugin

Sometimes when we have target image already existing in system, and so caused the docker-maven-plugin failed to temporarily tag. After checked, found following code.

 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 with such errors, is it possible to remove the exception or add a parameter to toggle on/off the exception?

bug prio1

Most helpful comment

Sorry for the super late response, not sure why this issue was below my radar.

I agree that we should be more conservative here and I'm going to tackle this for the next release.

All 17 comments

Please remove this codeline as the user's docker version tag will take care of replacing it OR failing to let the user know of an existing tag image.

https://stackoverflow.com/questions/31605661/how-to-prevent-docker-images-on-docker-hub-from-being-overwritten

Just hit this problem after changing my config from

            <configuration>
                <images>
                    <image>
                        <name>my-registry:12345/my-app</name>
                        <build>
                            <tags>
                                <tag>latest</tag>

to

            <configuration>
                <pushRegistry>my-registry:12345</pushRegistry>
                <images>
                    <image>
                        <name>my-app</name>
                        <build>
                            <tags>
                                <tag>latest</tag>

Is one way correct and one way wrong?

I am having this issue as well on several projects, but not on others.

Is there any update to the status of the code that @NancyChunlan pasted above?

@gnboorse I didn't get any update yet, as workaround, we use script to remove target images before the plugin.

@NancyChunlan we ended up moving away from this plugin actually. We are now doing the docker and java builds separately.

Sorry for the super late response, not sure why this issue was below my radar.

I agree that we should be more conservative here and I'm going to tackle this for the next release.

@rhuss
Any update on this? I'm running into the same issue and there have been two releases since your last post as far as I can tell.

Fixed in #1170.

when can we expect this to available in https://mvnrepository.com/artifact/io.fabric8/docker-maven-plugin
i am facing same issue with

<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.31.0</version>

Hmm, I think most probably around Christmas. But Roland can answer it more precisely since he maintains it

I will try to make a release before the end of the week, or early next week.

Sorry for the delay, year end stress here :)

Hi @rhuss when do you think it can be released and will available in https://mvnrepository.com/?

Sorry, PTO was more vacation than expected ;-) But now that I'm back on track, I'm already preparing the release so should be out at latest at the end of this week.

This issue is still observed occasionally in latest release v0.33.0
[INFO] --- docker-maven-plugin:0.33.0:push (push-when-install) @ my-project
[INFO] DOCKER> The push refers to repository [my repo]
[INFO] DOCKER> latest: digest: sha256:
[ERROR] DOCKER> Image :latest could be pushed, but the temporary tag could not be removed

Hi, I am also facing this error in v0.33.0.

Could you please post a sample project so that could be reproduced ?

This issue is observed occasionally, or I can even say "rarely". The related projects are very common, nothing special.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

flungo picture flungo  路  10Comments

chanjarster picture chanjarster  路  7Comments

vrenjith picture vrenjith  路  7Comments

leonardinius picture leonardinius  路  5Comments

mixaaaa picture mixaaaa  路  5Comments