我有以下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:
字符串nginx
映像的构建过程如下
FROM nginx:latest
RUN rm /etc/nginx/conf.d/*
COPY nginx.conf /etc/nginx/conf.d/default.conf
型
其中nginx.conf
server {
listen 80;
location / {
proxy_pass http://webapp:8181;
}
}
型
但是在nginx
容器日志中:
nginx: [emerg] host not found in upstream "webapp" in /etc/nginx/conf.d/default.conf:6
型
为什么nginx
无法发现webapp
服务?
1条答案
按热度按时间hgtggwj01#
你的nginx反向代理和服务在同一个网络中吗?看起来它们不在同一个网络中。