This is very short tutorial to show how to quickly create a web server using Docker container. The Docker should be installed in your machine as a prerequesit.

First step is to create Dockerfile:

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

The based image is nginx:alpine and copy the content of your current directory to the nginx/html directory. For example, index.html with the following text:

<h1>Hello Ojitha</h1>

Now you have to run the Docker CLI command for the second step to create a docker image:

docker build -t <build-directory>

the paramter for t to tag the image: for example web-img:v1 (repository:version)

when you run the following command, you can find all the images available

docker images

Third step is to launch the docker image.

docker run -d -p 80:80 web-img:v1