Cannot connect to docker daemon

Having some trouble getting the docker provider (kreuzwerker/docker) running on terraform cloud. I’ve tried several different ‘host’ addresses for the provider when initializing (I’m using CDKTF), but always get the same error (obviously with different paths):

Error: Error pinging Docker server: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
with provider["registry.terraform.io/kreuzwerker/docker"]

Is there some special setup I need to do to get this working with the terraform cloud remote backend? I do have docker for MacOS installed locally, but I imagine this is looking for a docker daemon to be running on the cloud backend… I have run terraform init successfully, and terraform providers does return a kreuzwerker/docker version installed.

2 Likes

Im having the same issue. If anyone can point us into a direction that fixes this that would be great!

i think terraform cloud agent seems not have docker engine installed by default there so it won’t work

Hi @jaismith,

The default remote operations mechanism where Terraform is running in an execution environment managed by Terraform Cloud itself is not appropriate for working with APIs that are accessible only on your local network or local computer. The hosted execution environment is intended for the case of working with cloud services whose APIs are available on the public internet.

For services running directly on your local computer I would suggest disabling remote operations altogether and just running Terraform locally so it can reach your localhost server.

For shared services running on a local network, you can potentially run an agent in that same network to allow Terraform to run there and access services that the hosted agents would not be able to reach.