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

running application including dependency on spring-boot-docker-compose results in throwing a DockerOutputParseException when used with Docker Compose 1.29.2 #36725

Closed
pi-jMelange opened this issue Aug 4, 2023 · 7 comments

Comments

@pi-jMelange
Copy link

Hello,

with issues #35383 and #36618 @albilu, @digiron and @yurets1 reported that launching an application including a dependency on spring-boot-docker-compose results in throwing an org.springframework.boot.docker.compose.core.DockerOutputParseException: Failed to parse docker JSON.

In issue #35383 @scottfrederick commented that Spring Boot

(...) will try docker compose first, and fall back to docker-compose if the former does not work.

If I am not mistaken, @scottfrederick is referring to the method org.springframework.boot.docker.compose.core.DockerCli$DockerCommands.getDockerComposeCommand, where the command docker compose version --format json (processRunner.run("docker", "compose", "version", "--format", "json")) is followed by a command docker-compose version --format json (processRunner.run("docker-compose", "version", "--format", "json")) in case the first call results in an exception.

The stacktrace hints that the second call is involved in throwing above mentioned exception, with

at org.springframework.boot.docker.compose.core.DockerJson.deserialize(DockerJson.java:79) ~[spring-boot-docker-compose-3.1.2.jar:3.1.2]
	at org.springframework.boot.docker.compose.core.DockerJson.deserialize(DockerJson.java:71) ~[spring-boot-docker-compose-3.1.2.jar:3.1.2]
	at org.springframework.boot.docker.compose.core.DockerCli$DockerCommands.getDockerComposeCommand(DockerCli.java:164) ~[spring-boot-docker-compose-3.1.2.jar:3.1.2]

and DockerCli.java:164

DockerCliComposeVersionResponse response = DockerJson.deserialize(
						processRunner.run("docker-compose", "version", "--format", "json"),
						DockerCliComposeVersionResponse.class);

If I interpret the documentation right, the command docker-compose version does not support the option --format json, what may be the reason for the above mentioned exception.

Running docker-compose version --format json results in the following output:

Show version information and quit.

Usage: version [--short]

Options:
    --short     Shows only Compose's version number.

This reads like help text rather than the result of the actual command, and hints that docker-compose version may be called with the option --short instead .

Running docker-compose version --short results in the output of the version number in the format v.v.v.

Could this help to find a (hopefully) simple solution, or have I misinterpreted or missed something? What do you think?

Thank you very much!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 4, 2023
@wilkinsona
Copy link
Member

I suspect this is a duplicate of #36618. What version of Docker Compose are you using?

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Aug 4, 2023
@pi-jMelange
Copy link
Author

Hello @wilkinsona,

thank you very much for coming back to this topic!

You are right, I continued the topic described in both #35383 and #36618 (and I am very sorry in case you would have preferred it if I continued directly there).

I may be wrong, but to me it seems that regardless of the version of Docker Compose you are using, the implemented fallback mechanism either would not be performed or would fail, since the commands docker compose version and docker-compose version (as one of three exceptions) differ in more than the dash. So I suggested using docker-compose version --short instead of docker-compose version --format json as part of fallback handling.

Thank you very much!

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Aug 4, 2023
@mhalbritter
Copy link
Contributor

On my machine, both

docker-compose version --format json
{"version":"2.20.2"}
docker compose version --format json
{"version":"2.20.2"}

work. What version of Docker Compose are you using?

@mhalbritter
Copy link
Contributor

mhalbritter commented Aug 4, 2023

The reason this fallback is in there, is that we want to both support Docker Compose when installed as a docker plugin (docker compose) and docker compose as a standalone (docker-compose).

See this:

They both have the JSON support for the version command. I suspect you're using an old version of docker compose which is missing this support.

@pi-jMelange
Copy link
Author

Thank you very much for your feedback and the additional input, @mhalbritter!

I think I now understand better the background of the decision made with the implementation of the method org.springframework.boot.docker.compose.core.DockerCli$DockerCommands.getDockerComposeCommand, which makes a lot of sense.

I can confirm your suspicions: both @albilu and @yurets1 reported this behavior with Docker Compose 1.29.2 and I was able to reproduce it with the very same version. While I am aware of Docker's statement regarding their support, I understand that, for reasons I do not know, this is the version Canonical still considers supported with Ubuntu's latest LTS release being part of the standard apt software repository. This means, if someone does not want to add anything other than the standard apt software repository (e.g. to avoid potential dependency conflicts), that would be the version available on the system.

Having seen, that you already have a mechanism in place to find out which command to use, I was hoping that a (hopefully) small change could make this feature available to those using the standard apt software repository as well.

If the standalone version of Docker Compose continues to support the command docker-compose version --short, it seems that switching to this command could support all standalone versions.

Of course I fully understand that you need to make decisions where your efforts are best invested and result in the best quality!

Thank you very much!

@wilkinsona
Copy link
Member

Thanks, @pi-jMelange. We do not plan to support Docker Compose 1.x. The burden of testing it and the ongoing maintenance outweighs the benefits as it's now end-of-life and folks should be migrating to 2.x.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Aug 4, 2023
@wilkinsona wilkinsona removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Aug 4, 2023
@pi-jMelange
Copy link
Author

Thank you very much for your feedback, @wilkinsona!

I appreciate your and @mhalbritter's efforts with looking into this topic!

Thank you very much!

@pi-jMelange pi-jMelange changed the title application including dependency on spring-boot-docker-compose results in throwing a DockerOutputParseException application including dependency on spring-boot-docker-compose results in throwing a DockerOutputParseException when used with Docker Compose 1.29.2 Aug 5, 2023
@pi-jMelange pi-jMelange changed the title application including dependency on spring-boot-docker-compose results in throwing a DockerOutputParseException when used with Docker Compose 1.29.2 running application including dependency on spring-boot-docker-compose results in throwing a DockerOutputParseException when used with Docker Compose 1.29.2 Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants