I have 2 docker windows container deployed with docker compose. Proxy and Web, Both running Nginx One is reverse proxy other is serving content simple index.html page. When run everything works as expected i can access content via proxy. But if I restart web i get bad gate way and need to restart proxy to get it working again.
How to get this working without need to restart proxy?
Docker-compose
version: '3'
services:
web:
build:
context: ./web
dockerfile: ./dockerfile
proxy:
build:
context: ./proxy
dockerfile: ./dockerfile
ports:
- "8089:80"
Proxy: Dockerfile:
FROM sixeyed/nginx:windowsservercore
COPY nginx.conf C:/nginx/conf
CMD C:\nginx\nginx.exe
nginx.config:
events {
}
http {
server {
listen 80;
server_name localhost;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://web:80/;
}
}
}
web: Dockerfile:
FROM sixeyed/nginx:windowsservercore
COPY nginx.conf C:/nginx/conf
COPY index.html C:/nginx/html/index.html
CMD C:\nginx\nginx.exe
nginx.config:
events {
}
http {
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
}
}