Skip to content

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

@pi-jMelange

Description

@pi-jMelange

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions