Nginx web server Docker image based on Debian GNU/Linux

About

The automated build docker Nginx image “linuxconfig/nginx” can be used as a basic testing environment for a static websites deployments.

Configuration

The image is build based on default Nginx webserver configuration running on Debian GNU/Linux. Nginx webserver run in foreground and listens on default port 80.

Usage

Create a directory and place your static website within.

$ mkdir html
$ echo "My Static Website" > html/index.html
OR
$ cp -r /path/to/your/static/website/* html/

Deploy nginx docker container based on “linuxconfig/nginx” docker image.

$ sudo docker run -d --name=nginx -p 80 -v $PWD/html:/var/www/html linuxconfig/nginx

The above command will deploy a new docker container named nginx. Check a port redirection from random local port to port 80 within nginx container:

$ sudo docker port nginx
80/tcp -> 0.0.0.0:49153

At this stage you will be able to access your static website via a local port 49153 on your host system:

$ curl http://localhost:49153
Nginx Docker Container