Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error: Failed to initialize connection to podman server #15

Open
p4nu opened this issue Jun 9, 2022 · 8 comments
Open

Error: Failed to initialize connection to podman server #15

p4nu opened this issue Jun 9, 2022 · 8 comments

Comments

@p4nu
Copy link

p4nu commented Jun 9, 2022

Wanted behaviour

Create terraform.tfstate

Occured behaviour

Error: Failed to initialize connection to podman server

  with provider["registry.terraform.io/project0/podman"],
  on main.tf line 9, in provider "podman":
   9: provider "podman" {}

URI: unix:///run/podman/podman.sock, error: unable to connect to Podman socket: Get
"http://d/v4.0.3/libpod/_ping": dial unix /run/podman/podman.sock: connect: no such
file or directory

Reproduce steps

  • Add this to main.tf
terraform {
  required_providers {
    podman = {
      source = "project0/podman"
    }
  }
}

provider "podman" {}

resource "podman_network" "network" {}
  • Run terraform init and terraform apply

System info

Using Ubuntu 22.04 on WSL2.
Terraform version: 1.2.2 on linux_amd64
Podman version: 3.4.4

@project0
Copy link
Owner

project0 commented Jun 9, 2022

Hey, thanks for the report 👍.
I want to mention this project is stil in very early phase and i am currently re-consider some things around the connection itself, etc.. :-).

I see two things what might contribute to your problem:

  1. The provider targets for podman v4, i think even the podman connection library is checking the version (via ping) for compatibility. As there are have been also a bunch of breaking changes, v4 will be a requirement.

  2. Did you even start the podman api? The error message indicates the socket of the daemon is either not available or you just dont have enough permissions. It should even work rootless (if userid mapping is properly configured).

podman system service --time=0 unix:///tmp/podman.sock
podman system service --time=0 tcp://localhost:8888
provider "podman" {
uri = "unix:///tmp/podman.sock"
// or 
uri = "tcp://localhost:8888
}

@project0
Copy link
Owner

project0 commented Jun 9, 2022

btw, As you seem to use podman in windows you may want to check the native installation guide as well: https://github.com/containers/podman/blob/main/docs/tutorials/podman-for-windows.md#installing-podman

@p4nu
Copy link
Author

p4nu commented Jun 9, 2022

As you seem to use podman in windows you may want to check the native installation guide as well.

I have tried the native installation but unfortunately it doesn't work atm. It currently does this: containers/podman#14416

Did you even start the podman api?

If I can run podman run hello-world the podman api should be started?

The provider targets for podman v4, i think even the podman connection library is checking the version (via ping) for compatibility. As there are have been also a bunch of breaking changes, v4 will be a requirement.

v4 is not currently in original Ubuntu packages, so I will try upgrading it manually. 👍

@project0
Copy link
Owner

project0 commented Jun 9, 2022

If I can run podman run hello-world the podman api should be started?

No, podman works different than docker. Docker depends fully on a running engine (daemon). For podman its different, the server (api) is just a optional component and you need to start it by intention.

you can usually (not sure if its packaged in ubuntu) enable the service systemctl enable --now podman

@p4nu
Copy link
Author

p4nu commented Jun 9, 2022

I want to mention this project is stil in very early phase and i am currently re-consider some things around the connection itself, etc.. :-).

I'd love to see this to have same named resources as in docker to make switch from docker to podman a breeze in the future

@p4nu
Copy link
Author

p4nu commented Jun 9, 2022

you can usually (not sure if its packaged in ubuntu) enable the service systemctl enable --now podman

systemctl is not unfortunately packaged in wsl ubuntu

@hapylestat
Copy link

@p4nu then move to the wsl2, it is available there

@p4nu
Copy link
Author

p4nu commented Aug 19, 2022 via email

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants