Can podman be used with terraform and docker plugin? #20440
Unanswered
2fxprogeeme
asked this question in
Q&A
Replies: 1 comment
-
Yes although I have no idea why the container is being removed. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I use rootless podman 4.6.2 on Linux Mint and want to execute some tutorials with terraform. My idea is to enable podman socket and set the "host" variable in the terraform configuration of the docker plugin to point to the podman socket.
The terraform file is very simple.
terraform {
required_providers {
docker = {
source = "kreuzwerker/docker"
version = "3.0.2"
}
}
}
provider "docker" {
host = "unix:///run/user/1000/podman/podman.sock"
}
resource "docker_image" "nginx" {
name = "nginx:latest"
keep_locally = false
}
resource "docker_container" "nginx" {
image = docker_image.nginx.image_id
name = "tutorial"
ports {
internal = 80
external = 8080
}
}
When executing "terraform apply" the NGINX image ist downloaded an the container is started. So far, so good.
When executing "terraform destroy" I get the following error message:
Error: Error waiting for container removal 'ca008b9680b276a65d685a6b10218073e2614efab632ffea9711c49d78be6f40': Error response from daemon: no such container
But when executing "podman ps -a" after the error message the container exists no longer. So the container was stopped and destroyed.
So my question: Is my idea to substitute docker by podman using podman.socket the correct was for this?
Thanks in advance for any comment.
Best regards
Ulrich
Beta Was this translation helpful? Give feedback.
All reactions