Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Intended behavior for docker_image on destroy? #3609

Closed
ryane opened this issue Oct 23, 2015 · 2 comments
Closed

Intended behavior for docker_image on destroy? #3609

ryane opened this issue Oct 23, 2015 · 2 comments

Comments

@ryane
Copy link
Contributor

ryane commented Oct 23, 2015

What is the intended behavior when running terraform destroy on a docker_image resource? Currently, the image is not actually removed:

provider "docker" {}
resource "docker_image" "nginx" {
  name = "nginx:latest"
  keep_updated = false
}
$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE

$ terraform apply
docker_image.nginx: Creating...
  keep_updated: "" => "0"
  latest:       "" => "<computed>"
  name:         "" => "nginx:latest"
docker_image.nginx: Creation complete

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

The state of your infrastructure has been saved to the path
below. This state is required to modify and destroy your
infrastructure, so keep it safe. To inspect the complete state
use the `terraform show` command.

State path: terraform.tfstate

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
nginx               latest              5c82215b03d1        8 days ago          132.9 MB

$ terraform destroy -force
docker_image.nginx: Refreshing state... (ID: 5c82215b03d10884d98e0c074a69881e7428484c47855d49863233297f86fd9anginx:latest)
docker_image.nginx: Destroying...
docker_image.nginx: Destruction complete

Apply complete! Resources: 0 added, 0 changed, 1 destroyed.

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
nginx               latest              5c82215b03d1        8 days ago          132.9 MB

It does not appear that there is any code in resource_docker_image_funcs.go to actually remove the image so I was wondering if this is intentional.

@stack72
Copy link
Contributor

stack72 commented Apr 4, 2016

Closed as Fixed in #5801

@ghost
Copy link

ghost commented Apr 26, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants