我想将我的本地 url 从 'localhost:port' 更改为项目相关的 url。堆栈中的每个其他容器(节点服务器等)都可以工作,但只有 swagger 容器会给出错误 502 Bad Gateway。
我将此添加到我的 /etc/hosts 文件中:
127.0.0.1 my-api-doc.local
这是我的 docker-compose.yml 文件:
version: '3'
services:
api_doc:
image: swaggerapi/swagger-ui
environment:
- "VIRTUAL_HOST=my-api-doc.local"
- "VIRTUAL_PORT=4000"
ports:
- "4000:8080"
links:
- nginx-proxy
nginx-proxy:
image: jwilder/nginx-proxy:alpine
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
restart: unless-stopped
问题是,当我在浏览器中转到“my-api-doc.local”时,收到“502 Bad Gateway”错误。当我尝试'localhost:4000'时,它可以工作。