Deploying Docker Images Using Terraform

Deploying Docker Images Using Terraform
Written by Abhishek JalanApril 18, 2020
1 min read
Terraform
6 VIEWS 1 LIKES 0 DISLIKES SHARE
1 LIKES 0 DISLIKES 6 VIEWS SHARE
Abhishek Jalan

DevSecOps Engineer

We're going to create a Terraform file that deploys a Nginx Docker image.

Create a Terraform File

Create main.tf:

vi main.tf

main.tf:
resource "docker_image" "nginx_image" {
name = "nginx:latest"
}

Initialize Terraform

terraform init

Plan the Deployment

Execute terraform plan:

terraform plan -out=tf_image_plan

Apply the Terraform Plan

Apply the plan:

terraform apply tf_image_plan
Docker
DevOps
Terraform
6 VIEWS 1 LIKES 0 DISLIKES SHARE
1 LIKES 0 DISLIKES 6 VIEWS SHARE
Was this blog helpful?
You must be Logged in to comment
Code Block
Abhishek Jalan
DevSecOps Engineer
+21 more
17 Blog Posts
4 Discussion Threads
Trending Categories
93
Software12
DevOps34
Frontend Development13
Backend Development13
Server Administration13
Linux Administration12
Data Center14
Sentry11
Terraform15
Ansible9
Docker13
Penetration Testing12
Kubernetes12
NGINX8
JenkinsX10
Jenkins18
SSL6
Ethical-Hacking10
Python8
NodeJs9
RedHat8
Github11
AngularJs15
Google Cloud Platform (GCP)6
SonarQube9
Amazon Web Service (AWS)2
VMware17
Blockchain6
Snipe-IT7