I have defined a terraform recipe with a docker provisioner like this:
provider "docker" {
host = "tcp://127.0.0.1:2375/"
}
# Create the network
resource "docker_network" "private_network" {
name = "${var.customer_name}_network"
}
resource "docker_container" "goagent" {
image = "${docker_image.goagent.latest}"
name = "${var.customer_name}_goagent"
command = [ "/bin/sh", "-c", "/usr/bin/supervisord" ]
network_mode = "bridge"
networks = [ "${docker_network.private_network.name}" ]
hostname = "${var.customer_name}_goagent"
}
resource "docker_image" "goagent" {
name = "local/goagent"
}
I would expect that the container will be connected just to the network created on the fly (using the variable customer_name). But what I see is that the container gets connected also to the default bridge network (172.17.0.0/16), so it gets connected to two networks.
Is there a way to configure the container in terraform in a way that it gets connected only to the network I specify in the networks list?
Apparently this is an unresolved bug as of 0.10.8
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With