Skip to content

Instantly share code, notes, and snippets.

@anguschiu1
Last active September 4, 2019 09:43
Show Gist options
  • Save anguschiu1/dff0b2dbed4e50a6663837f3bb506020 to your computer and use it in GitHub Desktop.
Save anguschiu1/dff0b2dbed4e50a6663837f3bb506020 to your computer and use it in GitHub Desktop.
Play with Nginx docker image

Simplest trial

docker pull nginx
docker run --name some-nginx -p 8080:80 -v html:/usr/share/nginx/html:ro -d nginx

Using Dockerfile (preferred, cleaner)

  1. Create a Dockerfile (e.g. on working directory c:\Users\itangusc\dev
FROM nginx
COPY html /usr/share/nginx/html
  1. Create html in c:\Users\itangusc\dev, and create a index.html (e.g.) into html
<html>
<body>
<h1>Hello Ngnix!</h>
    <h2>This is the first Nginx web server I build</h2>
</body>
</html>
  1. Run docker build -t some-content-nginx . on working directoy
  2. Start the container by docker run --name some-nginx -d some-content-nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment