terraform-provider-docker icon indicating copy to clipboard operation
terraform-provider-docker copied to clipboard

Support for Podman

Open mcanevet opened this issue 4 years ago • 7 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Since Podman v2.0.0, a REST API is available and support Docker API v1.40 (https://podman.io/blogs/2020/07/01/rest-versioning.html). I tried it with this provider and some stuffs works, other don't. I'm wondering if we could support more stuffs. First step would be to make acceptance tests run with the Podman API:

sudo DOCKER_HOST=unix:///run/podman/podman.sock make testacc

or in root-less mode:

DOCKER_HOST=unix:///run/user/1000/podman/podman.sock make testacc

References

  • https://podman.io/blogs/2020/07/01/rest-versioning.html

mcanevet avatar Jan 03 '21 08:01 mcanevet

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days. If you don't want this issue to be closed, please set the label pinned.

github-actions[bot] avatar Mar 29 '21 10:03 github-actions[bot]

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days. If you don't want this issue to be closed, please set the label pinned.

github-actions[bot] avatar Jun 06 '21 10:06 github-actions[bot]

I don't have any experience with Podman. I installed it on my M1 Mac, tried to run the tests with it and it complained with issues about volumes and such. It would be great of someone from the community would take this over and drive this topic!

Junkern avatar Sep 02 '22 14:09 Junkern

It works for me. 😄

  • Find out the podman socket
$ podman machine inspect| jq ".[].ConnectionInfo.PodmanSocket.Path"
"/Users/jamie/.local/share/containers/podman/machine/podman-machine-default/podman.sock"
  • Terraform block
terraform {
  required_providers {
    docker = {
      source  = "kreuzwerker/docker"
      version = "~>2.22.0"
    }
  }
}
  • Provider block
provider "docker" {
  host = "unix:///Users/jamie/.local/share/containers/podman/machine/podman-machine-default/podman.sock"
}

hcmlinj avatar Oct 14 '22 15:10 hcmlinj

That's great! Are you able to run the tests as mentioned in https://github.com/kreuzwerker/terraform-provider-docker/blob/master/CONTRIBUTING.md ?

Junkern avatar Oct 14 '22 15:10 Junkern

No, I think I couldn't. I've tried run go test -v -count=1 -race ./... after alias docker="podman". It failed in: https://github.com/kreuzwerker/terraform-provider-docker/blob/0588c2071bbe77459e4b7e4cee7e6c050ba499a5/internal/provider/data_source_docker_plugin_test.go#L13 But it's still an awesome terraform provider to me. I can finish the tutorial Build Infrastructure - Terraform Docker Example via podman instead of docker.

hcmlinj avatar Oct 15 '22 10:10 hcmlinj

I started some work in https://github.com/kreuzwerker/terraform-provider-docker/pull/495 Edit: Got it to work ~~If anyone could support in getting the self-signed certificates to work, that would be amazing!~~

Junkern avatar Dec 22 '22 16:12 Junkern