[Bug]: Can't overwrite Docker socket path with 2.0.2 / Podman stopped working
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- docker, java, postgresql
- 领域
- databases, devops, testing-qa
调研方向
从日志中显示的 DockerClientFactory 以及 UnixSocketClientProviderStrategy 和 DockerDesktopClientProviderStrategy 条目入手。在设置 DOCKER_HOST 和 TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE 的情况下复现 PostgreSQL 集成测试,然后追踪 Podman socket 被忽略的原因。完成的标准是 Testcontainers 2.0.2 采用配置的 socket,并且集成测试能够成功启动。
由索引模型根据 Issue 内容生成。
描述
Module
PostgreSQL
Testcontainers version
2.0.2
Using the latest Testcontainers version?
Yes
Host OS
Linux, Fedora 43
Host Arch
x86
Docker version
podman version
Client: Podman Engine
Version: 5.7.0
API Version: 5.7.0
Go Version: go1.25.4 X:nodwarf5
Git Commit: 0370128fc8dcae93533334324ef838db8f8da8cb
Built: Tue Nov 11 01:00:00 2025
Build Origin: Fedora Project
OS/Arch: linux/amd64
What happened?
Sorry if this is a duplicate, I wasn't able to find this issue.
I've been using Podman without any issues with the 1.x release series for years now following instructions like these. However it seems these environment variables are not respected anymore, because after upgrading some of our projects to Spring Boot 4 (which includes tc 2.0) I can't run integration tests anymore. Even after setting the following environment variables it still fails with the same message looking for /var/run/docker.sock, so something seems to be off:
DOCKER_HOST=unix:///run/user/1000/podman/podman.sock
TESTCONTAINERS_RYUK_DISABLED=true
TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=unix:///run/user/1000/podman/podman.sock
Relevant log output
13:53:24.585 [main] INFO org.testcontainers.images.PullPolicy - Image pull policy will be performed by: DefaultPullPolicy()
13:53:24.589 [main] INFO org.testcontainers.utility.ImageNameSubstitutor - Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
13:53:24.609 [main] INFO org.testcontainers.DockerClientFactory - Testcontainers version: 2.0.2
13:53:25.218 [main] INFO org.testcontainers.dockerclient.DockerMachineClientProviderStrategy - docker-machine executable was not found on PATH ([/usr/bin, /home/user/.jenv/libexec, /home/user/.sdkman/candidates/java/current/bin, /home/user/.jenv/shims, /home/user/.local/bin, /home/user/bin, /usr/local/bin, /usr/bin, /bin, /usr/local/sbin, /usr/sbin, /sbin, /var/lib/snapd/snap/bin, /home/user/go/bin, /home/user/.jenv/bin, /home/user/.npm-global/bin, /opt/go/bin])
13:53:25.220 [main] ERROR org.testcontainers.dockerclient.DockerClientProviderStrategy - Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
UnixSocketClientProviderStrategy: failed with exception InvalidConfigurationException (Could not find unix domain socket). Root cause NoSuchFileException (/var/run/docker.sock)
DockerDesktopClientProviderStrategy: failed with exception NullPointerException (Cannot invoke "java.nio.file.Path.toString()" because the return value of "org.testcontainers.dockerclient.DockerDesktopClientProviderStrategy.getSocketPath()" is null)As no valid configuration was found, execution cannot continue.
See https://java.testcontainers.org/on_failure.html for more details.
Additional Information
The only "config" we use is this line in the application-testing.yaml:
spring:
datasource:
url: jdbc:tc:postgresql:17-alpine://hostname/database
- 主要语言
- Java
- 星标
- 8.7k
- 派生
- 1.9k
- 平均合并
- 2 天 17 小时
- 30 天内合并 PR
- 9
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
testcontainers/testcontainers-java 的其他 Issue
-
type/bug
难度 2/5 1-3 小时 新手友好度 78/100
testcontainers/testcontainers-java#11997 · 1 条评论 ·
-
[Enhancement]: Document why singleton containers are required under Spring's test context caching 未关闭type/enhancement
难度 1/5 1 小时以内 新手友好度 85/100
testcontainers/testcontainers-java#11967 ·
-
type/bug
难度 2/5 1-3 小时 新手友好度 78/100
testcontainers/testcontainers-java#11941 ·
-
type/bug
难度 2/5 1-3 小时 新手友好度 74/100
testcontainers/testcontainers-java#11829 · 1 条评论 ·
-
type/enhancement
难度 2/5 1-3 小时 新手友好度 65/100
testcontainers/testcontainers-java#11578 ·
查看 testcontainers/testcontainers-java 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 76/100
-
bug needs triage
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 1/5 1 小时以内 新手友好度 94/100
objectionary/hone-maven-plugin#1061 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
spring-projects/spring-modulith#1895 ·