-
Notifications
You must be signed in to change notification settings - Fork 92
In Docker provider 'networks' appends new nets to the default bridge #10
Comments
This is still happening with version
|
Any news on this? |
@efpe when I'm done with the swarm approach, I'll take a look at the other issues. No ETA atm |
@mavogel great to hear the issues is picked up :) Thanks! |
Another thing I found as a work around was to put one of the networks in the "network_mode" configuration so:
This basically causes terraform to attach the container to "net1" during the creation of the container and then "attach" to the rest of the networks post-create. Doing a second "attach" when its already attached seems to be a no-op with docker. |
as @bhuisgen denotes his commit fixes the bug 👍 It will come with the upcoming release the config provider "docker" {
version = "1.1.0"
host = "unix:///var/run/docker.sock"
}
resource "docker_image" "alpine" {
name = "alpine:latest"
keep_locally = true
}
resource "docker_container" "alpine" {
name = "foo"
image = "${docker_image.alpine.latest}"
command = ["ip", "a"]
networks = ["tf-net"]
} and he following steps # use the current master branch
# for mac
$ go build -o terraform-provider-docker_v1.1.0 && mv -f terraform-provider-docker_v1.1.0 ~/.terraform.d/plugins/darwin_amd64
$ docker network create tf-net
$ terraform apply result in "Networks": {
"tf-net": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"f9ee6e24549b"
],
"NetworkID": "d4d2a6aa3c7411c913bd10a0232d915f307521bdd60d4cac9653aff3f159e4cb",
"EndpointID": "",
"Gateway": "",
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "",
"DriverOpts": null
}
} |
This issue was originally opened by @fdebonneval as hashicorp/terraform#12095. It was migrated here as part of the provider split. The original body of the issue is below.
Hi there, I hope this issue have not already been reported, I took a look and did not find duplicate.
Anyway, thanks for telling me if it is an expected behavior or a genuine issue to fix.
Terraform Version
# terraform --version Terraform v0.8.7
Affected Resource(s)
Terraform Configuration Files
Debug Output
The
docker logs
of the container returnsAlso
Docker inspect
of the created container :Expected Behavior
With only one network in the list, I would expect only one 'eth0' interface inside the running container
Actual Behavior
I get the default bridge and the network from the list.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd):/tf --workdir /tf hashicorp/terraform:light apply
The text was updated successfully, but these errors were encountered: