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

Support podman for the Docker Compose feature #43440

Open
philiplourandos opened this issue Dec 7, 2024 · 5 comments
Open

Support podman for the Docker Compose feature #43440

philiplourandos opened this issue Dec 7, 2024 · 5 comments
Labels
type: enhancement A general enhancement
Milestone

Comments

@philiplourandos
Copy link

philiplourandos commented Dec 7, 2024

Environment

  • OS: Ubuntu 24.10
  • Java: OpenJDK Runtime Environment GraalVM CE 23.0.1+11.1 (build 23.0.1+11-jvmci-b01)
  • Podman: podman version 5.0.3
  • Spring boot: 3.4.0

The problem

I have created a very quick demo project using start.spring.io and seeing the same behaviour I am seeing in my project. Error is as follows:

[INFO] --- spring-boot:3.4.0:run (default-cli) @ demo ---
[INFO] Attaching agents: []

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                (v3.4.0)

2024-12-07T17:57:33.159+02:00  INFO 190325 --- [demo] [           main] com.example.demo.DemoApplication         : Starting DemoApplication using Java 23.0.1 with PID 190325 (/home/philip/Downloads/demo/target/classes started by philip in /home/philip/Downloads/demo)
2024-12-07T17:57:33.162+02:00  INFO 190325 --- [demo] [           main] com.example.demo.DemoApplication         : No active profile set, falling back to 1 default profile: "default"
2024-12-07T17:57:33.261+02:00  INFO 190325 --- [demo] [           main] .s.b.d.c.l.DockerComposeLifecycleManager : Using Docker Compose file /home/philip/Downloads/demo/compose.yaml
2024-12-07T17:57:33.656+02:00 ERROR 190325 --- [demo] [           main] o.s.boot.SpringApplication               : Application run failed

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


	at org.springframework.boot.docker.compose.core.DockerJson.deserialize(DockerJson.java:81) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.boot.docker.compose.core.DockerJson.deserialize(DockerJson.java:73) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.boot.docker.compose.core.DockerCli$DockerCommands.getDockerComposeCommand(DockerCli.java:161) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.boot.docker.compose.core.DockerCli$DockerCommands.<init>(DockerCli.java:137) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.boot.docker.compose.core.DockerCli.lambda$new$0(DockerCli.java:63) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1229) ~[na:na]
	at org.springframework.boot.docker.compose.core.DockerCli.<init>(DockerCli.java:62) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.boot.docker.compose.core.DockerCompose.get(DockerCompose.java:145) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.boot.docker.compose.lifecycle.DockerComposeLifecycleManager.getDockerCompose(DockerComposeLifecycleManager.java:166) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.boot.docker.compose.lifecycle.DockerComposeLifecycleManager.start(DockerComposeLifecycleManager.java:114) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:53) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:35) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:185) ~[spring-context-6.2.0.jar:6.2.0]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:178) ~[spring-context-6.2.0.jar:6.2.0]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:156) ~[spring-context-6.2.0.jar:6.2.0]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138) ~[spring-context-6.2.0.jar:6.2.0]
	at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136) ~[spring-boot-3.4.0.jar:3.4.0]
	at org.springframework.boot.context.event.EventPublishingRunListener.contextLoaded(EventPublishingRunListener.java:98) ~[spring-boot-3.4.0.jar:3.4.0]
	at org.springframework.boot.SpringApplicationRunListeners.lambda$contextLoaded$4(SpringApplicationRunListeners.java:72) ~[spring-boot-3.4.0.jar:3.4.0]
	at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118) ~[spring-boot-3.4.0.jar:3.4.0]
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112) ~[spring-boot-3.4.0.jar:3.4.0]
	at org.springframework.boot.SpringApplicationRunListeners.contextLoaded(SpringApplicationRunListeners.java:72) ~[spring-boot-3.4.0.jar:3.4.0]
	at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:416) ~[spring-boot-3.4.0.jar:3.4.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:317) ~[spring-boot-3.4.0.jar:3.4.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1361) ~[spring-boot-3.4.0.jar:3.4.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1350) ~[spring-boot-3.4.0.jar:3.4.0]
	at com.example.demo.DemoApplication.main(DemoApplication.java:10) ~[classes/:na]
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1]
	at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59) ~[jackson-databind-2.18.1.jar:2.18.1]
	at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:5008) ~[jackson-databind-2.18.1.jar:2.18.1]
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4910) ~[jackson-databind-2.18.1.jar:2.18.1]
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3860) ~[jackson-databind-2.18.1.jar:2.18.1]
	at org.springframework.boot.docker.compose.core.DockerJson.deserialize(DockerJson.java:78) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	... 27 common frames omitted

The docker-compose file looks like:

services:
  postgres:
    image: 'postgres:latest'
    environment:
      - 'POSTGRES_DB=mydatabase'
      - 'POSTGRES_PASSWORD=secret'
      - 'POSTGRES_USER=myuser'
    ports:
      - '5432'
  • Running docker-compose up from the CLI starts it up with no problems
  • I do have a podman aliasing dependency installed on the system so the normal docker commands work except using podman.
  • Using test containers from spring boot works fine.
  • Building OCI images works fine.

I'm not keen to switch from podman to docker, tho that is certainly one way to probably resolve this.

Any assistance would be appreciated

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 7, 2024
@mhalbritter mhalbritter changed the title Failure trying to use docker-compose with spring boot Failure trying to use podmon with spring boot Dec 9, 2024
@mhalbritter mhalbritter changed the title Failure trying to use podmon with spring boot Failure trying to use podman with spring boot Dec 9, 2024
@mhalbritter
Copy link
Contributor

mhalbritter commented Dec 9, 2024

Hello,

we're parsing the output of docker and docker compose (or docker-compose). As you have essentially symlinked podman to docker, this is not a supported arrangement. We can look into how much work it'd be to also support podman, but I can't make any promises because I don't know how much the podman output differs from docker.

What works is that you enable the podman socket and then use the original docker binary to use that socket. In effect, this runs your container with podman, but using docker and docker compose as a podman client. I've explicitly tested that scenario while working on the docker compose feature in Boot.

@mhalbritter mhalbritter changed the title Failure trying to use podman with spring boot Support podman for the Docker Compose feature Dec 9, 2024
@mhalbritter mhalbritter added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 9, 2024
@mhalbritter mhalbritter added this to the 3.x milestone Dec 9, 2024
@philiplourandos
Copy link
Author

Hello,

we're parsing the output of docker and docker compose (or docker-compose). As you have essentially symlinked podman to docker, this is not a supported arrangement. We can look into how much work it'd be to also support podman, but I can't make any promises because I don't know how much the podman output differs from docker.

What works is that you enable the podman socket and then use the original docker binary to use that socket. In effect, this runs your container with podman, but using docker and docker compose as a podman client. I've explicitly tested that scenario while working on the docker compose feature in Boot.

Thanks Moritz. Will give that a try and provide feedback

@philiplourandos
Copy link
Author

I seem to be having the same issue. I have enabled podman as a service in systemd:

● podman.service - Podman API Service
     Loaded: loaded (/etc/systemd/system/podman.service; enabled; preset: enabled)
     Active: active (running) since Wed 2024-12-11 11:26:18 SAST; 35s ago
 Invocation: c3dd44fe44dd4992a4e4533d33a7ffce
TriggeredBy: ● podman.socket
       Docs: man:podman-system-service(1)
   Main PID: 7275 (podman)
      Tasks: 9 (limit: 23613)
     Memory: 11.7M (peak: 12.2M)
        CPU: 170ms
     CGroup: /system.slice/podman.service
             └─7275 /usr/bin/podman --log-level=info system service tcp:127.0.0.1:8080 --time=0

Dec 11 11:26:18 philip-VirtualBox systemd[1]: Starting podman.service - Podman API Service...
Dec 11 11:26:18 philip-VirtualBox systemd[1]: Started podman.service - Podman API Service.
Dec 11 11:26:18 philip-VirtualBox podman[7275]: time="2024-12-11T11:26:18+02:00" level=info msg="/usr/bin/podman filtering at log level info"
Dec 11 11:26:18 philip-VirtualBox podman[7275]: time="2024-12-11T11:26:18+02:00" level=info msg="Using sqlite as database backend"
Dec 11 11:26:18 philip-VirtualBox podman[7275]: time="2024-12-11T11:26:18+02:00" level=info msg="[graphdriver] using prior storage driver: overlay"
Dec 11 11:26:18 philip-VirtualBox podman[7275]: time="2024-12-11T11:26:18+02:00" level=info msg="Setting parallel job count to 13"
Dec 11 11:26:18 philip-VirtualBox podman[7275]: time="2024-12-11T11:26:18+02:00" level=warning msg="Using the Podman API service with TCP sockets is not recommended, please see `podman system service` manpage for details"
Dec 11 11:26:18 philip-VirtualBox podman[7275]: time="2024-12-11T11:26:18+02:00" level=info msg="API service listening on \"127.0.0.1:8080\". URI: \"tcp:127.0.0.1:8080\""

Spring log output:

[INFO] --- spring-boot:3.4.0:run (default-cli) @ data-parsers ---
[INFO] Attaching agents: []
2024-12-11T11:26:46.529+02:00  INFO 7476 --- [           main] org.za.sampra.parser.Application         : Starting Application using Java 23.0.1 with PID 7476 (/home/philip/dev/projects/stuart-parsers/target/classes started by philip in /home/philip/dev/projects/stuart-parsers)
2024-12-11T11:26:46.534+02:00  INFO 7476 --- [           main] org.za.sampra.parser.Application         : The following 1 profile is active: "local"
2024-12-11T11:26:46.670+02:00  INFO 7476 --- [           main] .s.b.d.c.l.DockerComposeLifecycleManager : Using Docker Compose file /home/philip/dev/projects/stuart-parsers/docker-compose.yml
2024-12-11T11:26:47.405+02:00 ERROR 7476 --- [           main] o.s.boot.SpringApplication               : Application run failed

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


	at org.springframework.boot.docker.compose.core.DockerJson.deserialize(DockerJson.java:81) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.boot.docker.compose.core.DockerJson.deserialize(DockerJson.java:73) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.boot.docker.compose.core.DockerCli$DockerCommands.getDockerComposeCommand(DockerCli.java:161) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.boot.docker.compose.core.DockerCli$DockerCommands.<init>(DockerCli.java:137) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.boot.docker.compose.core.DockerCli.lambda$new$0(DockerCli.java:63) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1229) ~[na:na]
	at org.springframework.boot.docker.compose.core.DockerCli.<init>(DockerCli.java:62) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.boot.docker.compose.core.DockerCompose.get(DockerCompose.java:145) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.boot.docker.compose.lifecycle.DockerComposeLifecycleManager.getDockerCompose(DockerComposeLifecycleManager.java:166) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.boot.docker.compose.lifecycle.DockerComposeLifecycleManager.start(DockerComposeLifecycleManager.java:114) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:53) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:35) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:185) ~[spring-context-6.2.0.jar:6.2.0]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:178) ~[spring-context-6.2.0.jar:6.2.0]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:156) ~[spring-context-6.2.0.jar:6.2.0]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138) ~[spring-context-6.2.0.jar:6.2.0]
	at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136) ~[spring-boot-3.4.0.jar:3.4.0]
	at org.springframework.boot.context.event.EventPublishingRunListener.contextLoaded(EventPublishingRunListener.java:98) ~[spring-boot-3.4.0.jar:3.4.0]
	at org.springframework.boot.SpringApplicationRunListeners.lambda$contextLoaded$4(SpringApplicationRunListeners.java:72) ~[spring-boot-3.4.0.jar:3.4.0]
	at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:118) ~[spring-boot-3.4.0.jar:3.4.0]
	at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112) ~[spring-boot-3.4.0.jar:3.4.0]
	at org.springframework.boot.SpringApplicationRunListeners.contextLoaded(SpringApplicationRunListeners.java:72) ~[spring-boot-3.4.0.jar:3.4.0]
	at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:416) ~[spring-boot-3.4.0.jar:3.4.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:317) ~[spring-boot-3.4.0.jar:3.4.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1361) ~[spring-boot-3.4.0.jar:3.4.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1350) ~[spring-boot-3.4.0.jar:3.4.0]
	at org.za.sampra.parser.Application.main(Application.java:17) ~[classes/:na]
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1]
	at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59) ~[jackson-databind-2.18.1.jar:2.18.1]
	at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:5008) ~[jackson-databind-2.18.1.jar:2.18.1]
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4910) ~[jackson-databind-2.18.1.jar:2.18.1]
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3860) ~[jackson-databind-2.18.1.jar:2.18.1]
	at org.springframework.boot.docker.compose.core.DockerJson.deserialize(DockerJson.java:78) ~[spring-boot-docker-compose-3.4.0.jar:3.4.0]
	... 27 common frames omitted

@mhalbritter
Copy link
Contributor

mhalbritter commented Dec 11, 2024

What is docker version and docker compose version showing?

It should show something like this:

> docker version
Client: Docker Engine - Community
 Version:           27.3.1
 API version:       1.41 (downgraded from 1.47)
 Go version:        go1.22.7
 Git commit:        ce12230
 Built:             Fri Sep 20 11:42:43 2024
 OS/Arch:           linux/amd64
 Context:           podman

Server: linux/amd64/fedora-40
 Podman Engine:
  Version:          5.3.1
  APIVersion:       5.3.1
  Arch:             amd64
  BuildTime:        2024-11-21T01:00:00+01:00
  Experimental:     false
  GitCommit:        
  GoVersion:        go1.22.7
  KernelVersion:    6.11.10-200.fc40.x86_64
  MinAPIVersion:    4.0.0
  Os:               linux
 Conmon:
  Version:          conmon version 2.1.12, commit: 
  Package:          conmon-2.1.12-2.fc40.x86_64
 OCI Runtime (crun):
  Version:          crun version 1.18.2
commit: 00ab38af875ddd0d1a8226addda52e1de18339b5
rundir: /run/user/1000/crun
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  Package:          crun-1.18.2-1.fc40.x86_64
 Engine:
  Version:          5.3.1
  API version:      1.41 (minimum version 1.24)
  Go version:       go1.22.7
  Git commit:       
  Built:            Thu Nov 21 01:00:00 2024
  OS/Arch:          linux/amd64
  Experimental:     false

the docker client is from docker, and the server is a podman.

If your client is a podman, too, then there's something wrong on your machine. The client needs to be a docker, not a podman.

@mhalbritter
Copy link
Contributor

Please leave this issue open, as we'd like to add Podman support.

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

3 participants