Difficulty: beginner
Estimated Time: 5-10 minutes

In this scenario, you'll learn how to create a Docker Image for running a static HTML website using Nginx. The scenario will explain how to build a Docker Image running Nginx with your HTML site.

The aim is to help you understand how to create and run Docker Images created by yourself.

Don’t stop now! The next scenario will take about 20 minutes to complete. You can pause and come back at any time.

Deploy Static HTML Website as Container

Step 1 of 3

Step 1 - Create Dockerfile

Docker Images start from a base image. The base image should include the platform dependencies required by your application, for example, having the JVM or CLR installed.

This base image is defined as an instruction in the Dockerfile. Docker Images are built based on the contents of a Dockerfile. The Dockerfile is a list of instructions describing how to deploy your application.

In this example, our base image is the Alpine version of Nginx. This provides the configured web server on the Linux Alpine distribution.


Create your Dockerfile for building your image by copying the contents below into the editor.

FROM nginx:alpine
COPY . /usr/share/nginx/html

The first line defines our base image. The second file copies the content of the current directory into a particular location inside the container.