Skip to content

Instantly share code, notes, and snippets.

@peterkappus
Last active January 5, 2019 10:20
Show Gist options
  • Save peterkappus/c45b2bb3ea53e9d756fbe806947dffb3 to your computer and use it in GitHub Desktop.
Save peterkappus/c45b2bb3ea53e9d756fbe806947dffb3 to your computer and use it in GitHub Desktop.
Use docker to host a local html file with nginx!
# What is it? Use docker to host an html file using nginx!
# Pre-requisites: You've installed docker and logged into docker-hub
#make our html file
echo "<h1>Hello world</h1>" > index.html
#start docker and mount our current working directory into nginx
docker run -p 80:80 -v "$(PWD)":/usr/share/nginx/html:ro -d nginx
#go have a look!
open http://localhost
#make some changes to the HTML file in the host and reload to see your changes in real-time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment