Skip to content

Add support for publishing docker images to a registry #21001

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

Closed
philwebb opened this issue Apr 17, 2020 · 13 comments
Closed

Add support for publishing docker images to a registry #21001

philwebb opened this issue Apr 17, 2020 · 13 comments
Assignees
Labels
Milestone

Comments

@philwebb
Copy link
Member

philwebb commented Apr 17, 2020

Currently we don't have the option to publish a locally built docker image to a remote repository. You can do it using the docker CLI, but it would be nice to have some built in support.

@philwebb philwebb added this to the 2.x milestone Apr 17, 2020
@philwebb philwebb added the type: enhancement A general enhancement label Apr 17, 2020
@philwebb philwebb modified the milestones: 2.x, 2.4.x Jun 5, 2020
@jayanth-iyer

This comment has been minimized.

@jorgemoralespou
Copy link

I don't think this use case should be something the spring-boot maven plugin should do. If it did, shouldn't it also need to include goals to deploy the application/image into different platforms?
I think that users should stick to using multiple plugins rather than have one single plugin that does it all (not saying can't be provided by spring-boot). I saw that pattern in fabric8 maven plugin, and they had to slowly rollback and break that plugin into smaller ones, more single purposed.
My 2 cents.

@davinkevin

This comment has been minimized.

@jorgemoralespou

This comment has been minimized.

@philwebb

This comment has been minimized.

@jorgemoralespou
Copy link

I think then thy my comment is not outdated. #21001 (comment)

@philwebb
Copy link
Member Author

philwebb commented Sep 3, 2020

@jorgemoralespou Can you elaborate a bit more on the problems we might face? I was originally thinking we might be able to shell out and call docker push. I think that's currently how jib deals with it.

@jorgemoralespou
Copy link

Well, there's 2 sides:

  • Technical: You'd need to be able to support private and insecure registries, and you'd need to interface with Docker on Windows/Mac/Linux in different ways, so better to not shell out to docker but rather use a library that can deal with the pushing direclty.
  • Strategically: To me this is the real deal. If the spring-boot plugin start doing this, then what else? where's the line of what should be done in this plugin vs other plugins? To be honest, maven/gradle users know how to configure multiple plugins and how to call them, so what would be the difference of doing something like: mvn spring-boot:build-image spring-boot:push-image vs mvn spring-boot:build-image other-plugin:push-image.? I have in mind fabric8 times, now jKube and they struggle and broke it down as it was doing just way too much in a single place. Single purposed plugins that can be composed should be favoured in my opinion.

@philwebb philwebb added the for: team-attention An issue we'd like other members of the team to review label Sep 3, 2020
@philwebb
Copy link
Member Author

philwebb commented Sep 3, 2020

If there was a single purpose Maven and Gradle plugin that we could lean on and perhaps automatically configure (so you don't need to give the image tag) that would be an ideal option. The only one I found when looking previously was jib, and pushing isn't really a stand-alone feature. I also didn't have much luck finding a Java library that can talk to the registry, only Go and Python seem to exist. Perhaps RegistryClient from jib will be extracted into a library at some point.

@scottfrederick
Copy link
Contributor

Images can be tagged and pushed using the Docker daemon API, letting the daemon do all the work. We're in the process of adding support for authenticating to a registry from the daemon, which should suffice for pushing also.

We've generally tried to maintain parity between the Boot plugins and the pack CLI. pack supports pushing to a registry with a pack build --publish option. I don't think there's much risk of scope creep with just adding a comparable feature to the Boot plugins.

@philwebb philwebb removed the for: team-attention An issue we'd like other members of the team to review label Sep 9, 2020
@scottfrederick scottfrederick self-assigned this Sep 29, 2020
@scottfrederick scottfrederick changed the title Add support for publishing docker images to a repo Add support for publishing docker images to a registry Oct 1, 2020
@scottfrederick scottfrederick modified the milestones: 2.4.x, 2.4.0-M4 Oct 7, 2020
scottfrederick added a commit to scottfrederick/spring-boot that referenced this issue Oct 7, 2020
A docker registry running in testcontainers behaves
differently in CI vs running locally. Disabling the tests for
now while working on getting them running reliably in CI.

See spring-projectsgh-21001
@theHilikus
Copy link

theHilikus commented Jul 22, 2021

the way the maven lifecycle is structured, it seems to me that publishing should be separate from building. the build-image goal attaches to the package phase, which makes sense, but not publishing. That should be done in the maven deploy phase. I haven't been able to find a way to only build in package and only publish in deploy. Am I missing something?

@scottfrederick
Copy link
Contributor

@theHilikus There is some discussion of this in #26187. We've tried to keep the focus of the Spring Boot build plugins on Cloud Native Buildpacks integration, and avoid adding features to cover the full lifecycle of an OCI image.

@theHilikus
Copy link

I missed that ticket. thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants