Skip to content

Instantly share code, notes, and snippets.

@andergmartins
Created March 29, 2016 14:13
Show Gist options
  • Save andergmartins/0cdcc710adcd96732977 to your computer and use it in GitHub Desktop.
Save andergmartins/0cdcc710adcd96732977 to your computer and use it in GitHub Desktop.
How to use nginx as proxy to set virtual hosts for docker containers
# From: http://stackoverflow.com/questions/18497564/assigning-vhosts-to-docker-ports
# start the reverse proxy
docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock jwilder/nginx-proxy
# start a first container for http://tutum.test.local
docker run -d -e "VIRTUAL_HOST=tutum.test.local" tutum/hello-world
# start a second container for http://deis.test.local
docker run -d -e "VIRTUAL_HOST=deis.test.local" deis/helloworld
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment