I'm trying to use Testcontainers inside the Multistage Build Dockerfile, and it's currently failing with :
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
Is there a way to mount /var/run/docker.sock in a Multistage build ? Or is there an alternative than having to mount the docker.sock ?
To my knowledge, accessing Docker (and specifically the Docker socket of the host at /var/run/docker.sock
) is not trivially possible at the current point in time. However, you can configure the Docker build to access the daemon over the network, as outlined in this answer.