Difference between revisions of "Create Terraform Infrastructure with Docker"
Jump to navigation
Jump to search
Tags: Mobile web edit, Mobile edit |
|||
(3 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
main.tf | main.tf | ||
− | |||
<pre> terraform { | <pre> terraform { | ||
required_providers { | required_providers { | ||
Line 27: | Line 26: | ||
} | } | ||
</pre> | </pre> | ||
+ | |||
+ | terraform init | ||
+ | |||
+ | terraform apply | ||
+ | |||
+ | docker ps | ||
+ | |||
+ | terraform destroy | ||
+ | |||
+ | == Related == | ||
+ | * [[Terraform Associate]] | ||
+ | |||
+ | == See also == | ||
+ | * {{terraform providers}} | ||
+ | |||
+ | [[Category: Terraform]] |
Latest revision as of 09:47, 2 April 2023
main.tf
terraform { required_providers { docker = { source = "kreuzwerker/docker" version = "~> 2.15.0" } } } provider "docker" {} resource "docker_image" "nginx" { name = "nginx:latest" keep_locally = false } resource "docker_container" "nginx" { image = docker_image.nginx.latest name = "tutorial" ports { internal = 80 external = 8000 } }
terraform init
terraform apply
docker ps
terraform destroy
Related[edit]
See also[edit]
Advertising: