Create required directories
mkdir -p /etc/docker/nginx/{conf.d,html}
Configure nginx as webserver
cat <<EOF> /etc/docker/nginx/conf.d/default.conf server { listen 80; server_name _; root /usr/share/nginx/html; index index.html index.htm; } EOF
Configure nginx as proxy
cat <<EOF> /etc/docker/nginx/conf.d/proxy.conf server { listen 80; server_name foo.example.com; location / { proxy_pass http://localhost:8080/; } } EOF
Create container
sudo docker run -d \ --name nginx \ --net host \ -v /etc/docker/nginx/html:/usr/share/nginx/html:ro \ -v /etc/docker/nginx/conf.d:/etc/nginx/conf.d:ro \ nginx
debug
docker restart nginx
docker logs nginx -f