From b4522d2e05e06ce200843d4ef840465600e8d540 Mon Sep 17 00:00:00 2001 From: Nishant Totla Date: Sat, 10 Dec 2016 02:43:09 -0800 Subject: [PATCH] Updating README Signed-off-by: Nishant Totla --- README.md | 32 ++++++++++++++++++++++++++++++-- index.html | 2 +- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 10e7fb4..8aeea5c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,30 @@ -# DockerStaticSite -A simple static website using Docker and Nginx +# A Static Site using Docker and Nginx + +This repo contains code for building a simple static website served using an Nginx container inside Docker. The code for the site is contained in `index.html`, and the Nginx config is in `default.conf`. The Dockerfile contains commands to build a Docker Image. + +To build a Docker image from the Dockerfile, run the following command from inside this directory + +```sh +$ docker build -t /staticsite:1.0 . +``` +This will produce the following output + +```sh +Sending build context to Docker daemon 81.41 kB +Step 1/3 : FROM nginx:alpine + ---> 2f3c6710d8f2 +Step 2/3 : COPY default.conf /etc/nginx/conf.d/default.conf + ---> Using cache + ---> 176c56cc07b6 +Step 3/3 : COPY index.html /usr/share/nginx/html/index.html + ---> 3407953dafd0 +Removing intermediate container cb64bb3e3aca +Successfully built 3407953dafd0 +``` + +To run the image in a Docker container, use the following command +```sh +$ docker run -itd --name mycontainer --publish 8080:80 /staticsite:1.0 +``` + +This will start serving the static site on port 8080. If you visit `http://localhost:8080` in your browser, you should be able to see our static site! \ No newline at end of file diff --git a/index.html b/index.html index d493c81..756b717 100644 --- a/index.html +++ b/index.html @@ -1,3 +1,3 @@

Hello World!

-

This is a simple static website being served from nginx running inside a Docker container!

\ No newline at end of file +

This is a simple static website being served from Nginx running inside a Docker container!

\ No newline at end of file