Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Simple example of a docker file setting up a container for serving static content with nginx.

Notifications You must be signed in to change notification settings

jtsaito/docker-nginx-static

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Docker running Nginx static content

Getting started.

  1. When on OS X boot2docker provides a VirtualBox VM virtual machine for Docker to run on. Initialize and start up boot2docker with
boot2docker init
boot2docker up

Export the resulting environment variables (DOCKER_HOST, DOCKER_CERT_PATH, DOCKER_TLS_VERIFY).

  1. Build the Docker container in the root path.
docker build -t foo:nginx_static .
  1. Run the container.
docker run -p 80:80 foo:nginx_static
  1. Grab the IP of the Docker host.
boot2docker ip

This should display the static html page.

You can now go on to commit the container to be re-used later. To that end, get the container id with docker ps yielding, e.g. 61aa913398ca. Then commit.

docker commit -m "Add nginx serving index.html file statically." 61aa913398ca foo:nginx_static

This will yield a length weired ting. Finally you can stop the docker container now.

docker kill 61aa913398ca

About

Simple example of a docker file setting up a container for serving static content with nginx.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages