I'm getting a nullPointer error because the container ids are not available. What could be the reason for this?
I use the latest version of all technologies.
Comment From: scottfrederick
@hudaiapa88 Please re-test with a released version of Spring Boot instead of the RC1 version. If you are still having problems, please share the version of Docker Compose that you are using and a complete minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it and attaching it to this issue.
Comment From: hudaiapa88
project file= docker.zip
As you can see, I am using the current version of the technologies. But I still get the same error.
Comment From: scottfrederick
@hudaiapa88 Thank you for the sample. After downloading and building your sample, I can run ./mvnw spring-boot:run and see that the MySQL container and the Spring Boot application start up with no errors.
Please run docker compose version (or docker-compose version) and respond with the version that's shown. Also, please post stack traces as text with the full trace instead of as images so we can get a complete picture of the error.
Comment From: hudaiapa88
C:\Windows\system32>docker-compose version Docker Compose version v2.22.0-desktop.2
[INFO]
[INFO] --- spring-boot:3.1.4:run (default-cli) @ docker ---
[INFO] Attaching agents: []
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.1.4)
2023-10-02T18:21:10.343+03:00 INFO 7564 --- [ main] com.uc.docker.DockerApplication : Starting DockerApplication using Java 17.0.3 with PID 7564 (C:\github_demo_projeler\docker\target\classes started by HUDAI in C:\github_demo_projeler\docker)
2023-10-02T18:21:10.347+03:00 INFO 7564 --- [ main] com.uc.docker.DockerApplication : No active profile set, falling back to 1 default profile: "default"
2023-10-02T18:21:10.439+03:00 INFO 7564 --- [ main] .s.b.d.c.l.DockerComposeLifecycleManager : Using Docker Compose file 'C:\github_demo_projeler\docker\compose.yaml'
2023-10-02T18:21:12.899+03:00 ERROR 7564 --- [ main] o.s.boot.SpringApplication : Application run failed
java.lang.NullPointerException: null
at java.base/java.util.Objects.requireNonNull(Objects.java:208) ~[na:na]
at java.base/java.util.ImmutableCollections.listFromArray(ImmutableCollections.java:190) ~[na:na]
at java.base/java.util.List.of(List.java:1047) ~[na:na]
at org.springframework.boot.docker.compose.core.DockerCliCommand.<init>(DockerCliCommand.java:57) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.core.DockerCliCommand.<init>(DockerCliCommand.java:48) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.core.DockerCliCommand$Inspect.<init>(DockerCliCommand.java:131) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.core.DefaultDockerCompose.inspect(DefaultDockerCompose.java:90) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.core.DefaultDockerCompose.getRunningServices(DefaultDockerCompose.java:80) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.lifecycle.DockerComposeLifecycleManager.start(DockerComposeLifecycleManager.java:120) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:53) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:35) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:174) ~[spring-context-6.0.12.jar:6.0.12]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167) ~[spring-context-6.0.12.jar:6.0.12]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:145) ~[spring-context-6.0.12.jar:6.0.12]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:133) ~[spring-context-6.0.12.jar:6.0.12]
at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.context.event.EventPublishingRunListener.contextLoaded(EventPublishingRunListener.java:98) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplicationRunListeners.lambda$contextLoaded$4(SpringApplicationRunListeners.java:72) ~[spring-boot-3.1.4.jar:3.1.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.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplicationRunListeners.contextLoaded(SpringApplicationRunListeners.java:72) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:419) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298) ~[spring-boot-3.1.4.jar:3.1.4]
at com.uc.docker.DockerApplication.main(DockerApplication.java:10) ~[classes/:na]
@scottfrederick
Comment From: scottfrederick
Docker Compose plugin v2.21 includes a change that breaks compatibility with previous versions of the plugin. Spring Boot will need to adapt to support both the old and new output formats.
Comment From: hudaiapa88
@scottfrederick So which docker version do you recommend me to use?
Comment From: scottfrederick
@hudaiapa88 I believe any version earlier than v2.21 will work. You might try v2.20.3. On Linux you can download a binary from the Compose plugin release page on GitHub and install it manually. I'm not sure what the process is for doing that on Windows.
Comment From: hudaiapa88
@scottfrederick
C:\Windows\system32>docker-compose --version
Docker Compose version v2.17.2
I installed this version and I still get the same error.
Comment From: scottfrederick
@hudaiapa88 I think there's still something different between your environment and the environments I'm testing on. It would be helpful if you could run these commands in your sample project and show the output:
docker compose version
docker compose up -d
docker compose ps --format=json
Comment From: hudaiapa88
PS C:\github_demo_projeler\modulith> docker compose version
Docker Compose version v2.19.0
PS C:\github_demo_projeler\modulith> docker compose up -d
[+] Running 1/0
✔ Container modulith-db-1 Running 0.0s
PS C:\github_demo_projeler\modulith> docker compose ps --format=json
[{"ID":"6e415c776da188a89658ae1afc5e6f5707272559b90eadc3a01d43d95cb498e3","Name":"modulith-db-1","Image":"postgres","Command":"docker-entrypoint.sh postgres","Project":"modulith","Serv
ice":"db","Created":1696277752,"State":"running","Status":"Up 2 hours","Health":"","ExitCode":0,"Publishers":[{"URL":"0.0.0.0","TargetPort":5432,"PublishedPort":5432,"Protocol":"tcp"}]}]
@scottfrederick I ran it and this is the result
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.1.4)
2023-10-03T01:07:36.871+03:00 INFO 16936 --- [ main] com.uc.modulith.ModulithApplication : Starting ModulithApplication using Java 17.0.3 with PID 16936 (C:\github_demo_projeler\modulith\target\classes started by HUDAI in C:\github_demo_projeler\modulith)
2023-10-03T01:07:36.875+03:00 INFO 16936 --- [ main] com.uc.modulith.ModulithApplication : No active profile set, falling back to 1 default profile: "default"
2023-10-03T01:07:36.995+03:00 INFO 16936 --- [ main] .s.b.d.c.l.DockerComposeLifecycleManager : Using Docker Compose file 'C:\github_demo_projeler\modulith\compose.yaml'
2023-10-03T01:07:39.411+03:00 ERROR 16936 --- [ main] o.s.boot.SpringApplication : Application run failed
java.lang.NullPointerException: null
at java.base/java.util.Objects.requireNonNull(Objects.java:208) ~[na:na]
at java.base/java.util.ImmutableCollections.listFromArray(ImmutableCollections.java:190) ~[na:na]
at java.base/java.util.List.of(List.java:1047) ~[na:na]
at org.springframework.boot.docker.compose.core.DockerCliCommand.<init>(DockerCliCommand.java:57) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.core.DockerCliCommand.<init>(DockerCliCommand.java:48) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.core.DockerCliCommand$Inspect.<init>(DockerCliCommand.java:131) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.core.DefaultDockerCompose.inspect(DefaultDockerCompose.java:90) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.core.DefaultDockerCompose.getRunningServices(DefaultDockerCompose.java:80) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.lifecycle.DockerComposeLifecycleManager.start(DockerComposeLifecycleManager.java:120) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:53) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:35) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:174) ~[spring-context-6.0.12.jar:6.0.12]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167) ~[spring-context-6.0.12.jar:6.0.12]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:145) ~[spring-context-6.0.12.jar:6.0.12]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:133) ~[spring-context-6.0.12.jar:6.0.12]
at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.context.event.EventPublishingRunListener.contextLoaded(EventPublishingRunListener.java:98) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplicationRunListeners.lambda$contextLoaded$4(SpringApplicationRunListeners.java:72) ~[spring-boot-3.1.4.jar:3.1.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.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplicationRunListeners.contextLoaded(SpringApplicationRunListeners.java:72) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:419) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298) ~[spring-boot-3.1.4.jar:3.1.4]
at com.uc.modulith.ModulithApplication.main(ModulithApplication.java:10) ~[classes/:na]
Disconnected from the target VM, address: '127.0.0.1:56546', transport: 'socket'
Process finished with exit code 1
Comment From: wilkinsona
Thanks. That JSON looks fine to me.
The only explanation that I can think of is that the path in your shell differs from the path when you're running the application and, as a result, the application is using a different version of Docker Compose. You could test this theory by debugging the application with a breakpoint on org.springframework.boot.docker.compose.core.DockerCliCommand.deserialize(String) and looking at the json there.
Comment From: bossm0n5t3r
I found the same issue.
The current docker compose cli version has been updated, and it is expected to be solved by attaching --no-trunc flag.
- updated version: https://github.com/docker/compose/releases/tag/v2.23.0
- related pr: https://github.com/docker/compose/pull/11038
Without --no-trunc flag
$ docker compose ps --format=json
{...,"ID":"d034853e71db","Image":"postgres:latest",...}
With --no-trunc flag
$ docker compose ps --format=json --no-trunc
{...,"ID":"d034853e71dbb0326a473cfa9ca179419334f6d31451ca507b677e1582c1af1c","Image":"postgres:latest",...}
I think it might help to add "--no-truc" at ComposePs
/**
* The {@code docker compose ps} command.
*/
static final class ComposePs extends DockerCliCommand<List<DockerCliComposePsResponse>> {
ComposePs() {
super(Type.DOCKER_COMPOSE, DockerCliComposePsResponse.class, true, "ps", "--format=json", "--no-trunc");
}
}
Comment From: scottfrederick
@bossm0n5t3r What you are describing appears to be a separate, but possibly related, problem. @hudaiapa88 was using earlier versions of Docker Compose, and the problem appears to be that the ID isn't getting parsed at all. I haven't been able to reproduce that problem with any version of Docker Compose.
If the truncation of the ID when using Docker Compose 2.23.0 is causing a problem, would you mind creating a new issue for that?
Comment From: bossm0n5t3r
@scottfrederick Ok, I will organize the contents and create a new one. Thank you!
Comment From: wilkinsona
Thanks for creating https://github.com/spring-projects/spring-boot/issues/37982, @bossm0n5t3r.
Comment From: scottfrederick
Docker Compose plugin v2.21 includes https://github.com/docker/compose/pull/10918 that breaks compatibility with previous versions of the plugin. Spring Boot will need to adapt to support both the old and new output formats.
While this output format did change, it does not break Spring Boot's parsing of the responses as I initially thought it would. I still can't reproduce this problem with any version of Docker Compose.
@hudaiapa88 Please use the suggestion Andy mentioned above and let us know what information that shows you.
Comment From: hudaiapa88
@scottfrederick
json={"Command":"\"docker-entrypoint.sh mysqld\"","CreatedAt":"2023-10-25 22:09:51 +0300 +03","ExitCode":0,"Health":"","ID":"70e4b8a107d5c7ab7fe906541d305de20ef211b93ab1bb9de8dde10b5e1f79fa","Image":"mysql:latest","Labels":"desktop.docker.io/ports/3306/tcp=0.0.0.0:0,com.docker.compose.container-number=1,com.docker.compose.project.working_dir=C:\\github_demo_projeler\\docker,com.docker.compose.image=sha256:2d9aad1b5856bbb040d01e4acddaaad74b5fbd7f620dac33e4e58ecc5d0aa86d,com.docker.compose.oneoff=False,com.docker.compose.project=docker,com.docker.compose.project.config_files=C:\\github_demo_projeler\\docker\\compose.yaml,com.docker.compose.service=mysql,com.docker.compose.version=2.22.0,com.docker.compose.config-hash=1264e8a0ae23410aa71b40347bda0b54a786b98a71ba11b10bf9624a82de8c05,com.docker.compose.depends_on=","LocalVolumes":"1","Mounts":"94d6844634f6e6a6099eaab3a6021c7103990c1c1a0c59e35232cb9722c759dd","Name":"docker-mysql-1","Names":"docker-mysql-1","Networks":"docker_default","Ports":"33060/tcp, 0.0.0.0:60081-\u003e3306/tcp","Publishers":[{"URL":"0.0.0.0","TargetPort":3306,"PublishedPort":60081,"Protocol":"tcp"},{"URL":"","TargetPort":33060,"PublishedPort":0,"Protocol":"tcp"}],"RunningFor":"2 minutes ago","Service":"mysql","Size":"0B","State":"running","Status":"Up 2 minutes"}
After this json I get an error like this
java.lang.NullPointerException: null
at java.base/java.util.Objects.requireNonNull(Objects.java:208) ~[na:na]
at java.base/java.util.ImmutableCollections.listFromArray(ImmutableCollections.java:190) ~[na:na]
at java.base/java.util.List.of(List.java:1047) ~[na:na]
at org.springframework.boot.docker.compose.core.DockerCliCommand.<init>(DockerCliCommand.java:57) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.core.DockerCliCommand.<init>(DockerCliCommand.java:48) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.core.DockerCliCommand$Inspect.<init>(DockerCliCommand.java:131) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.core.DefaultDockerCompose.inspect(DefaultDockerCompose.java:90) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.core.DefaultDockerCompose.getRunningServices(DefaultDockerCompose.java:80) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.lifecycle.DockerComposeLifecycleManager.start(DockerComposeLifecycleManager.java:120) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:53) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.boot.docker.compose.lifecycle.DockerComposeListener.onApplicationEvent(DockerComposeListener.java:35) ~[spring-boot-docker-compose-3.1.4.jar:3.1.4]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:174) ~[spring-context-6.0.12.jar:6.0.12]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167) ~[spring-context-6.0.12.jar:6.0.12]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:145) ~[spring-context-6.0.12.jar:6.0.12]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:133) ~[spring-context-6.0.12.jar:6.0.12]
at org.springframework.boot.context.event.EventPublishingRunListener.multicastInitialEvent(EventPublishingRunListener.java:136) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.context.event.EventPublishingRunListener.contextLoaded(EventPublishingRunListener.java:98) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplicationRunListeners.lambda$contextLoaded$4(SpringApplicationRunListeners.java:72) ~[spring-boot-3.1.4.jar:3.1.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.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:112) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplicationRunListeners.contextLoaded(SpringApplicationRunListeners.java:72) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:419) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309) ~[spring-boot-3.1.4.jar:3.1.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298) ~[spring-boot-3.1.4.jar:3.1.4]
at com.uc.docker.DockerApplication.main(DockerApplication.java:10) ~[classes/:na]
Disconnected from the target VM, address: '127.0.0.1:60096', transport: 'socket'
Process finished with exit code 1
Comment From: philwebb
I don't understand what's going on because the json seems to decode correctly.
@hudaiapa88 Can you try adding a breakpoint in the DefaultDockerCompose.inspect method. The exception seems to suggest that the ids list contains a null:
private Map<String, DockerCliInspectResponse> inspect(List<DockerCliComposePsResponse> runningPsResponses) {
List<String> ids = runningPsResponses.stream().map(DockerCliComposePsResponse::id).toList();
List<DockerCliInspectResponse> inspectResponses = this.cli.run(new DockerCliCommand.Inspect(ids));
return inspectResponses.stream().collect(Collectors.toMap(DockerCliInspectResponse::id, Function.identity()));
}
The means one of the DockerCliComposePsResponse records probably has a null ID. It's still not clear to me why this would be since the json seems to parse fine for me.
Comment From: philwebb
@hudaiapa88 One other thing. Can you check the version of Jackson you have on your classpath. Could it be possible that you're using a different version to us?
Comment From: hudaiapa88
@philwebb
A null reference comes in the command property
Comment From: philwebb
It's really confusing because that null should be a collection of IDs. I can't really see how it can be null because it should be created here and that toList() method should never return null.
Is there anything unusual about your project or setup? Have you tried with a fresh project created from start.spring.io to see if you have the same problem?
Perhaps you can debug a little further up the stack and try to work out how a new DockerCliCommand.Inspect instance is being created with null ids.
If possible, can you share your project on GitHub?
Comment From: hudaiapa88
docker.zip @philwebb When I got the first error, I created this project from start.spring.io. Then I got this error in the project I created.
Comment From: mhalbritter
Can you show us a screenshot of what runningPsResponses in org.springframework.boot.docker.compose.core.DefaultDockerCompose#getRunningServices
contains?
Comment From: ghost
Hi, I have the same problem. Seems that runningPsResponses have the truncated ID's and the inspected constais ID's without truncation.
Comment From: wilkinsona
@aalbiach-dkt that sounds more like https://github.com/spring-projects/spring-boot/issues/37982 than the problem described in this issue
Comment From: anil-ilgin
@philwebb , Hello, I think I've found the problem, I was getting the same error as this. Appearently, spring-docker-compose uses Fasterxml.Jackson and it deserializes fields by making making all letters lowercase first, and lowercases them by using the system locale language. Because of this, ID field in the "docker -ps" response was being lowercased as ıd, not id in Turkish. I switched my operating systems language to the English and problem solved. Not a plausable solution but at least the problem is found.
So, if there is a way to force jackson to use English without changing the os language, I'm happy to hear.
Comment From: mhalbritter
@anil-ilgin Thanks a lot for that pointer. That's it indeed!
This test fails:
@Test
void shouldBeLocaleAgnostic() {
Locale locale = Locale.getDefault();
try {
String json = """
[{"ID":"6e415c776da188a89658ae1afc5e6f5707272559b90eadc3a01d43d95cb498e3","Name":"modulith-db-1","Image":"postgres","Command":"docker-entrypoint.sh postgres","Project":"modulith",
"Service":"db","Created":1696277752,"State":"running","Status":"Up 2 hours","Health":"","ExitCode":0,"Publishers":[{"URL":"0.0.0.0","TargetPort":5432,"PublishedPort":5432,"Protocol":"tcp"}]}]
""";
Locale.setDefault(Locale.forLanguageTag("tr-TR"));
List<DockerCliComposePsResponse> response = DockerJson.deserializeToList(json,
DockerCliComposePsResponse.class);
assertThat(response).hasSize(1);
assertThat(response.get(0).id())
.isEqualTo("6e415c776da188a89658ae1afc5e6f5707272559b90eadc3a01d43d95cb498e3");
}
finally {
Locale.setDefault(locale);
}
}
So, if there is a way to force jackson to use English without changing the os language, I'm happy to hear.
There is, and we're going to take care of that.