我已经用docker Provisioner定义了一个Terraform配方,如下所示:
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"
}
我希望容器将仅连接到动态创建的网络(使用变量customer_name)。
但是我看到的是容器也连接到默认的桥接网络(172.17.0.0/16),因此它也连接到两个网络。
有没有一种方法可以在terraform中配置容器,使其仅连接到我在网络列表中指定的网络?
最佳答案
显然,这是从0.10.8开始的未解析bug