35 lines
610 B
HCL
35 lines
610 B
HCL
provider "docker" {
|
|
host = "ssh://ubuntu@3.9.10.22:22"
|
|
}
|
|
|
|
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
|
|
ports {
|
|
internal = 80
|
|
external = 80
|
|
}
|
|
networks_advanced {
|
|
name = docker_network.net1.name
|
|
}
|
|
volumes {
|
|
volume_name = docker_volume.vol1.name
|
|
container_path = "/usr/share/nginx/html"
|
|
}
|
|
}
|