我正试图在Multistage Build Dockerfile中使用Testcontainers,但它目前失败了:
ERROR --- [ main] o.t.d.DockerClientProviderStrategy : Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
ERROR --- [ main] o.t.d.DockerClientProviderStrategy : UnixSocketClientProviderStrategy: failed with exception InvalidConfigurationException (Could not find unix domain socket). Root cause NoSuchFileException (/var/run/docker.sock)
ERROR --- [ main] o.t.d.DockerClientProviderStrategy : As no valid configuration was found, execution cannot continue
有没有一种方法可以在多阶段构建中装载/var/run/doker.sock?或者,除了必须安装docker.sock之外,还有其他选择吗?
据我所知,在当前时间点访问Docker(特别是/var/run/docker.sock
主机的Docker套接字(是不可能的。但是,您可以将Docker构建配置为通过网络访问守护进程,如本答案所述。