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

network: timeout while waiting for state to become 'removed'

Open mavogel opened this issue 4 years ago • 5 comments

This issue was originally opened by @haai as https://github.com/hashicorp/terraform-provider-docker/issues/123. It was migrated here as a result of the community provider takeover from @kreuzwerker. The original body of the issue is below.


Terraform Version

terraform version
Terraform v0.11.12-dev
+ provider.docker v1.1.0

Affected Resource(s)

docker_network

Terraform Configuration Files

resource.tf

resource "docker_container" "centos" {
  image      = "${docker_image.centos.latest}"
  name       = "centos"
  hostname   = "centos.shadow"
  networks   = [ "shadow" ]
  restart    = "always"
  destroy_grace_seconds = 120

  command = [ "/bin/bash", "-c", "yum -y update; yum install -y nc; nc -l -k 80" ]

  ports {
    internal = 80
    external = 80
  }
}

resource "docker_image" "centos" {
  name = "centos:7"
}

resource "docker_network" "isolated" {
  name = "shadow"
}

provider "docker" {
  host = "tcp://127.0.0.1:2376/"
}

Debug Output

https://gist.github.com/haai/34d5d98820d1bf60c3c8b837ecdfeafc

Expected Behavior

The docker network should be removed.

Actual Behavior

Terraform is complaining: docker_network.isolated: timeout while waiting for state to become 'removed' (last state: 'pending', timeout: 30s)

Steps to Reproduce

terraform apply -auto-approve && terraform destroy -auto-approve

mavogel avatar Dec 25 '20 19:12 mavogel

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]

I ran into the same issue. My Docker network can not be removed due to active endpoints (but containers were removed). May be the same issue as described here: https://github.com/moby/moby/issues/17217

Not sure if that resolves the issue, but maybe we can disconnect each container from their connected networks before they are removed (or disconnect all containers from the network if it's removed, whatever makes more sense)? docker network disconnect -f {network} {endpoint-name}

saitho avatar Mar 30 '21 17:03 saitho

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 May 30 '21 10:05 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 Jul 30 '21 10:07 github-actions[bot]