Skip to content
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

Improve logging in DockerApi #43460

Open
PierrickPuimeanChieze opened this issue Dec 10, 2024 · 1 comment
Open

Improve logging in DockerApi #43460

PierrickPuimeanChieze opened this issue Dec 10, 2024 · 1 comment
Labels
type: enhancement A general enhancement
Milestone

Comments

@PierrickPuimeanChieze
Copy link

I got a problem when trying to use the gradle buildBootImage task. I managed to track the source of the problem and it was a problem with my installation of docker which refused to allow a _ping.
But the symptom was not really clear as I only got the following message : Docker API version must be at least 1.41 to support the 'imagePlatform' option, but current API version is 1.24
I think this could be a good idea to add a log message when you get an exception when trying to ping the docker installation.
But after looking at DockerAPI and SystemAPI classes, I don't really know which form it could take :

	class SystemApi {

		SystemApi() {
		}

		/**
		 * Get the API version supported by the Docker daemon.
		 * @return the Docker daemon API version
		 */
		ApiVersion getApiVersion() {
			try {
				URI uri = new URIBuilder("/_ping").build();
				try (Response response = http().head(uri)) {
					Header apiVersionHeader = response.getHeader(API_VERSION_HEADER_NAME);
					if (apiVersionHeader != null) {
						return ApiVersion.parse(apiVersionHeader.getValue());
					}
				}
				catch (Exception ex) {
					// fall through to return default value
                                        // Add a way to log the exception here ?
				}
				return MINIMUM_API_VERSION;
			}
			catch (URISyntaxException ex) {
				throw new IllegalStateException(ex);
			}
		}
}
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 10, 2024
@mhalbritter mhalbritter changed the title Introduce a way to log the error when retrieving the ApiVersion in spring-boot-buildpack-platform Improve logging in DockerApi Dec 10, 2024
@mhalbritter mhalbritter added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 10, 2024
@mhalbritter mhalbritter modified the milestones: 3.3.x, 3.x Dec 10, 2024
@philwebb
Copy link
Member

Note that #43452 is going to change this method a little

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

No branches or pull requests

4 participants