DevOps(Day-82): Terraform and Docker - Part2
TABLE OF CONTENTS
Task-02: Creating resource block for Docker image and container.
Task-02: Creating resource block for Docker image and container.
- Create a resource Block for an nginx docker image
- Create a resource Block for running a docker container for Nginx.
Note: In case Docker is not installed
sudo apt-get install
docker.io
sudo docker ps
sudo chown $USER /var/run/docker.sock
Now, the terraform file is created.
Let's execute the file.
- Use the below command which will Initialize a new Terraform configuration in the current directory. This command will download and install all necessary plugins or modules needed to execute the configuration.
Use the below command which will show an execution plan of the changes that Terraform will make to infrastructure, without actually making those changes. This command helps to identify potential issues before applying infrastructure changes.
Enter yes to apply the changes.
Now the docker container is created for the nginx image.
Navigate to the public URL to view the nginx default webpage.
Thanks for reading my article. Have a nice day.
Comments
Post a Comment