DEV Community

Cover image for Provision An NGINX Server Using Docker On Windows
Abisola Adesegun
Abisola Adesegun

Posted on

1

Provision An NGINX Server Using Docker On Windows

Table of Content
Step 1: Create a directory
Step 2: Create a file
Step 3: Provisioning Nginx using Terraform
Step 4: Verification
Step 5: Stop Container

To provision an NGINX server using Docker on Windows, you can follow this step-by-step guide:

Prerequisites:
Install Docker Desktop:

  • Download and install Docker Desktop for Windows from here.

  • Ensure Docker Desktop is running, and WSL2 integration is enabled (recommended but optional).

Step 1: Create a directory
Create a directory named learn-terraform-docker-container. This working directory houses the configuration files that you write to describe the infrastructure you want Terraform to create and manage.

Image description

Step 2: Create a file
Create another file called main.tf and paste the following Terraform configuration into it.

Image description

Image description

Step 3: Provisioning Nginx using Terraform

  • Initialize

To allow terraform interact with Docker, start the project with the folloeing code:

Image description

Image description

  • Plan

To Check or review changes.

Copy code

Image description

Image description

  • Apply

Provision the NGINX server container with apply. When Terraform asks you to confirm type yes and press ENTER.

Image description

Image description

Step 4: Verification
Verify the existence of the NGINX container by visiting localhost:8000 in your web browser or running docker ps to see the container.

Image description

Image description

Image description

Step 5: Stop Container
To stop the container,

Copy code and run

Image description

Image description

Image description

By following these steps, you have successfully provisioned an NGINX server on Windows using Docker. This setup can be customized by mounting configurations and static files into the container as needed.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more