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

Docker compose fails on parsing JSON #40084

Closed
Drezir opened this issue Mar 23, 2024 · 3 comments
Closed

Docker compose fails on parsing JSON #40084

Drezir opened this issue Mar 23, 2024 · 3 comments
Labels
for: external-project For an external project and not something we can fix status: duplicate A duplicate of another issue

Comments

@Drezir
Copy link

Drezir commented Mar 23, 2024

Demo application right from start.spring.io
Could relate to this: #35383

System:

Host: Vostro 5625 1.12.1 
Kernel: 6.7.9-200.fc39.x86_64 
Uptime: 1 hour, 39 mins 
Packages: 2704 (rpm), 42 (flatpak) 
Shell: bash 5.2.26 
Resolution: 1920x1200 
DE: GNOME 45.5 
WM: Mutter 
WM Theme: Adwaita 
Theme: Adwaita [GTK2/3] 
Icons: Adwaita [GTK2/3] 
Terminal: gnome-terminal 
CPU: AMD Ryzen 7 5825U with Radeon Graphics (16) @ 4.546GHz 
GPU: AMD ATI 05:00.0 Barcelo 
Memory: 13454MiB / 31433MiB 

Docker:
Docker version 26.0.0, build 2ae903e

 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.2.4)

2024-03-23T16:58:05.531+01:00  INFO 329374 --- [demo] [           main] com.example.demo.DemoApplication         : Starting DemoApplication using Java 21.0.2 with PID 329374 (/home/drezir/Stažené/demo(1)/demo/target/classes started by drezir in /home/drezir/Stažené/demo(1)/demo)
2024-03-23T16:58:05.533+01:00  INFO 329374 --- [demo] [           main] com.example.demo.DemoApplication         : No active profile set, falling back to 1 default profile: "default"
2024-03-23T16:58:05.581+01:00  INFO 329374 --- [demo] [           main] .s.b.d.c.l.DockerComposeLifecycleManager : Using Docker Compose file '/home/drezir/Stažené/demo(1)/demo/compose.yaml'
2024-03-23T16:58:05.783+01:00 ERROR 329374 --- [demo] [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.boot.docker.compose.core.DockerOutputParseException: Failed to parse docker JSON:

name: demo
services:
  postgres:
    environment:
      POSTGRES_DB: mydatabase
      POSTGRES_PASSWORD: secret
      POSTGRES_USER: myuser
    image: postgres:latest
    networks:
      default: null
    ports:
      - mode: ingress
        target: 5432
        protocol: tcp
networks:
  default:
    name: demo_default

	at org.springframework.boot.docker.compose.core.DockerJson.deserialize(DockerJson.java:81) ~[spring-boot-docker-compose-3.2.4.jar:3.2.4]
	at org.springframework.boot.docker.compose.core.DockerJson.deserialize(DockerJson.java:73) ~[spring-boot-docker-compose-3.2.4.jar:3.2.4]
	at org.springframework.boot.docker.compose.core.DockerCliCommand.deserialize(DockerCliCommand.java:77) ~[spring-boot-docker-compose-3.2.4.jar:3.2.4]
	at org.springframework.boot.docker.compose.core.DockerCli.run(DockerCli.java:81) ~[spring-boot-docker-compose-3.2.4.jar:3.2.4]
	at org.springframework.boot.docker.compose.core.DefaultDockerCompose.hasDefinedServices(DefaultDockerCompose.java:71) ~[spring-boot-docker-compose-3.2.4.jar:3.2.4]
	at org.springframework.boot.docker.compose.lifecycle.DockerComposeLifecycleManager.start(DockerComposeLifecycleManager.java:111) ~[spring-boot-docker-compose-3.2.4.jar:3.2.4]
	at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:53) ~[spring-boot-docker-compose-3.2.4.jar:3.2.4]
	at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:35) ~[spring-boot-docker-compose-3.2.4.jar:3.2.4]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:185) ~[spring-context-6.1.5.jar:6.1.5]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:178) ~[spring-context-6.1.5.jar:6.1.5]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:156) ~[spring-context-6.1.5.jar:6.1.5]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138) ~[spring-context-6.1.5.jar:6.1.5]
	at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136) ~[spring-boot-3.2.4.jar:3.2.4]
	at org.springframework.boot.context.event.EventPublishingRunListener.contextLoaded(EventPublishingRunListener.java:98) ~[spring-boot-3.2.4.jar:3.2.4]
	at org.springframework.boot.SpringApplicationRunListeners.lambda$contextLoaded$4(SpringApplicationRunListeners.java:72) ~[spring-boot-3.2.4.jar:3.2.4]
	at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118) ~[spring-boot-3.2.4.jar:3.2.4]
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112) ~[spring-boot-3.2.4.jar:3.2.4]
	at org.springframework.boot.SpringApplicationRunListeners.contextLoaded(SpringApplicationRunListeners.java:72) ~[spring-boot-3.2.4.jar:3.2.4]
	at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:432) ~[spring-boot-3.2.4.jar:3.2.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:333) ~[spring-boot-3.2.4.jar:3.2.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) ~[spring-boot-3.2.4.jar:3.2.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-3.2.4.jar:3.2.4]
	at com.example.demo.DemoApplication.main(DemoApplication.java:10) ~[classes/:na]
Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'name': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: (String)"name: demo
services:
  postgres:
    environment:
      POSTGRES_DB: mydatabase
      POSTGRES_PASSWORD: secret
      POSTGRES_USER: myuser
    image: postgres:latest
    networks:
      default: null
    ports:
      - mode: ingress
        target: 5432
        protocol: tcp
networks:
  default:
    name: demo_default"; line: 1, column: 5]
	at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2477) ~[jackson-core-2.15.4.jar:2.15.4]
	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:760) ~[jackson-core-2.15.4.jar:2.15.4]
	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._reportInvalidToken(ReaderBasedJsonParser.java:3041) ~[jackson-core-2.15.4.jar:2.15.4]
	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._reportInvalidToken(ReaderBasedJsonParser.java:3019) ~[jackson-core-2.15.4.jar:2.15.4]
	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._matchToken(ReaderBasedJsonParser.java:2793) ~[jackson-core-2.15.4.jar:2.15.4]
	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._matchNull(ReaderBasedJsonParser.java:2779) ~[jackson-core-2.15.4.jar:2.15.4]
	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:778) ~[jackson-core-2.15.4.jar:2.15.4]
	at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4912) ~[jackson-databind-2.15.4.jar:2.15.4]
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4818) ~[jackson-databind-2.15.4.jar:2.15.4]
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3772) ~[jackson-databind-2.15.4.jar:2.15.4]
	at org.springframework.boot.docker.compose.core.DockerJson.deserialize(DockerJson.java:78) ~[spring-boot-docker-compose-3.2.4.jar:3.2.4]
	... 23 common frames omitted


Process finished with exit code 1

demo.zip

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 23, 2024
@RuthAlk
Copy link

RuthAlk commented Mar 23, 2024

I ran into the exact same problem.
Ubuntu 22.04.4 LTS x86_64
Docker compose version v2.25.0

But I don't think the docker version matters, because if I justs do 'docker compose up' from the commandline with the same generated file (as in the logs), it works fine.
From the logs it seems as if the parser expects the file to be in json format instead of yaml?

@GarryMoveOut
Copy link

GarryMoveOut commented Mar 23, 2024

Same problem on OpenSuse Tumbleweed ver. 20240321 x64
Docker Compose version 2.25.0
Docker version 25.0.3-ce, build f417435e5

Few days ago was working. I think after updating OS/Docker something broken.
Spring Boot 3.2.4

@bclozel
Copy link
Member

bclozel commented Mar 23, 2024

I think this is a duplicate of #40060

@bclozel bclozel closed this as not planned Won't fix, can't repro, duplicate, stale Mar 23, 2024
@bclozel bclozel added status: duplicate A duplicate of another issue for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

5 participants