docker volumes and networks
This commit is contained in:
parent
6a5cd4bd00
commit
18c4858bea
1 changed files with 19 additions and 0 deletions
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue