Nginx as reverse proxy for docker containers -


i'm trying nginx reverse proxy connections within lan several web applications including ones inside docker containers.

both webapps reachable proxy_pass url

i'm using following dockerfile:

# set base image ubuntu ubuntu  run apt-get update run apt-get install -y nginx  run rm -v /etc/nginx/nginx.conf run echo "daemon off; \n\  \n\ worker_processes 1; \n\ events { worker_connections 1024; } \n\  \n\ http { \n\  \n\     server { \n\         listen 99; \n\  \n\         server_name dashboard; \n\         location / { \n\             proxy_pass http://dashboard:80; \n\         } \n\         location /app1 { \n\             proxy_pass http://otherhostname:9000/app1; \n\         } \n\     } \n\ } \n\  " >> /etc/nginx/nginx.conf expose 99 cmd service nginx start 

when running service (container) can reach app1, not dashboard.

the weird thing had working before, , i'm pretty sure did not change fundamental dockerfile. missing something?

edit: (i have exposed dashboard on port 80, , testing on 99 nginx)

i run nginx container with:

docker service create \     --replicas 1 \     --name nginx \     -p 99:99 \     nginx_image 

the dashboard has correct port exposed.

docker service create \     --replicas 1 \     --name dashboard \     -p 80:8080 \     dashboard_image 

looking in nginx error.log found:

2016/11/08 08:46:41 [error] 25#25: *42 upstream timed out (110: connection timed out) while connecting upstream, client: 10.255.0.3, server: dashboard, request: "get / http/1.1", upstream: "http://dockerhostip:80/", host: "dashboard:99" 

nginx working intended. found when changing proxy pass example.com works fine. must changed in dashboard messes things up.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -