I have the following docker-compose.yaml
version: '3'
services:
webapp:
image: example/webapp
build:
context: app
restart: always
ports:
- ":8181"
deploy:
replicas: 3
volumes:
- secret-store:/app/data
env_file:
- .env
networks:
- bridged_network
nginx:
image: example/reverseproxy
build:
context: reverseproxy
ports:
- "8181:80"
depends_on:
- webapp
networks:
bridged_network:
driver: bridge
volumes:
secret-store:
The nginx
image is being built as follows
FROM nginx:latest
RUN rm /etc/nginx/conf.d/*
COPY nginx.conf /etc/nginx/conf.d/default.conf
Where nginx.conf
server {
listen 80;
location / {
proxy_pass http://webapp:8181;
}
}
However in the nginx
container logs:
nginx: [emerg] host not found in upstream "webapp" in /etc/nginx/conf.d/default.conf:6
Why is nginx
failing to discover webapp
service?
Is your nginx reverse proxy in the same network as the service? It looks like they are not in the same network.