1
0
Fork 0

docker volumes and networks

This commit is contained in:
Cedric Girard 2020-05-15 12:11:32 +02:00
parent 6a5cd4bd00
commit 18c4858bea
Signed by: X-dark
GPG key ID: E7D0E125DB9519E4

View file

@ -6,6 +6,18 @@ resource "docker_image" "nginx" {
name = "nginx:latest"
}
resource "docker_network" "net1" {
name = "docker-net1"
driver = "bridge"
ipam_config {
subnet = "192.168.0.0/24"
}
}
resource "docker_volume" "vol1" {
name = "vol1"
}
resource "docker_container" "web" {
name = "foo"
image = docker_image.nginx.latest
@ -13,4 +25,11 @@ resource "docker_container" "web" {
internal = 80
external = 80
}
networks_advanced {
name = docker_network.net1.name
}
volumes {
volume_name = docker_volume.vol1.name
container_path = "/usr/share/nginx/html"
}
}