I installed terraform on WSL Ubuntu 22.04.3 LTS and it seems to be installed fine.
I installed Docker Desktop for Windows and the WSL Ubuntu doesn’t seem to be communicating with Docker. I get the following error:
Error: Error initializing Docker client: protocol not available
│
│ with provider[“Terraform Registry”],
│ on main.tf line 10, in provider “docker”:
│ 10: provider “docker” {
│
Error: Error pinging Docker server: Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?
│
│ with provider[“Terraform Registry”],
│ on main.tf line 10, in provider “docker”:
│ 10: provider “docker” {
Unless you have set up some port forwarding in WSL to send traffic targeted at port 2375 back to the address of the Windows host, I would expect Terraform is looking at your WSL instance, not at Windows for Docker. Check out the Stackoverflow link above as it has the steps to get the hostname.
Or, unless running Terraform in WSL and Docker in Windows is a hard requirement, download Terraform for Windows and run it there.