-
Notifications
You must be signed in to change notification settings - Fork 644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker:push goal pushing old docker images to private registry #575
Comments
Your observation is correct, using a registry this way creates a temporary tag, which then is pushed and removed afterwards (that's how Docker works, there's no way to provide a registry in other way). It avoids to overwrite or remove accidentally an already existing image, which I think is a good thing. For the next version I will break the build for this case so that at least you get aware of this. Another solution would be to temporarily remove the already existing image during the push, but this adds yet another step in the already complex (transactional) workflow. Would this be ok for you ? For your use case, you could add the registry as part of the |
Hi, thanks for your reply. Actually in some cases I need the image without the registry name to be produced. I'll explain better my use case. I am setting up a continuous integration system using docker to bring up the environment to run acceptance tests. Initially I used separated hosts for building images and running tests, and everything was working perfectly. When I started using the same hosts for both purposes, I noticed this issue. An additional requirement, is the ability to the developers to run the acceptance tests on their local machines before committing. To do this, the dev can build locally the containers using the docker:build maven command and then it can run the acceptance tests bringing up the environment with docker compose, without using the registry at all. For this reason, in some cases I need the image without the registry part, while in other cases I need the image with the registry part. Anyway, the proposed solution will do the job. I'll just need to do some logic with maven variables to support both cases. I'll let you know if this works! Thanks, |
Hi, I tested the proposed workaround and it works fine. Should I close this issue or do you want to keep it open to implement eventually a cleaner solution in the future? Thank very much for your support! Stefano |
Hi,
I build and push an image to my private registry with the command:
mvn clean docker:build docker:push
And this is how I configured the docker maven plugin:
In case no images are present in the host machine, everything works fine.
This command produces the
foo:latest
image on the host machine and pushes it to my private registryHowever, if the host machine contains an image tagged as
registry:5000/foo:latest
, the command still produces the updatedfoo:latest
image, but it pushes to the registry the already existingregistry:5000/foo:latest
image, instead of the new one.From looking at the code, it seems to me that this is some sort of expected behavior. But in that case, is there a way to configure the maven docker plugin to override in any case the existing
registry:5000/foo:latest
and push it?The text was updated successfully, but these errors were encountered: