I have 2 Windows Server Docker containers deployed with Docker Compose. One container runs a reverse proxy server and the other runs a web server. The web server serves a simple index.html page. Both are running Nginx.
When run, everything works as expected. I can access content via the proxy. But if I restart the web server I get a bad gateway error. I then need to restart the proxy to get it working again.
How do I get this working without the need to restart the 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
Proxy 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
Web nginx.config:
events {
}
http {
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
}
}