[英]Docker compose container behind nginx proxy cannot access internet
My goal is to set up a reverse proxy to connect to a sentry relay server via ssl. Essentially, the end goal is to forward traffic from a device to sentry.io through sentry relay, and the nginx server is so that this communication be can done through a secure connection.我的目标是设置一个反向代理通过ssl连接到哨兵中继服务器。本质上,最终目标是通过哨兵中继将流量从设备转发到sentry.io,而nginx服务器是这样的通信可以通过安全连接完成。
I have the following docker-compose.yml
:我有以下
docker-compose.yml
:
version: '3'
services:
nginx:
image: nginx:latest
container_name: nginx
volumes:
- nginx.conf:/etc/nginx/nginx.conf
- /etc/letsencrypt/:/etc/letsencrypt/
ports:
- 80:80
- 443:443
networks:
- relay-network
environment:
- ENV=production
- APPLICATION_URL=http://relay
relay:
image: getsentry/relay
container_name: relay
command: ["run", "--config", "/etc/relay/"]
volumes:
- config/:/etc/relay/
expose:
- "80"
networks:
- relay-network
networks:
relay-network:
Through the nginx and relay the logs I can see that I am able to connect to the relay container using an ssl connection.通过 nginx 和中继日志,我可以看到我能够使用 ssl 连接连接到中继容器。 However, all the sentry queries fail due to an invalid project id – I know this to be untrue because when I send messages with the same project id to the real sentry.io (not through my proxy), it works.
但是,由于项目 ID 无效,所有哨兵查询都失败了——我知道这是不正确的,因为当我将具有相同项目 ID 的消息发送到真正的哨兵时。io(不是通过我的代理),它起作用了。 My intuition is that the sentry relay server is unable to access the inte.net to verify the project id as real, so it tries to look for local project ids, of which there are none.
我的直觉是哨兵中继服务器无法访问 inte.net 以验证项目 ID 是否真实,因此它尝试查找本地项目 ID,但没有。
How can I make sure my relay container can connect to external.networks like sentry.io?如何确保我的中继容器可以连接到 external.networks,如 sentry.io?
Connect to your relay container interactively with docker exec -it relay bash
and try to ping something or load a page with curl
.使用
docker exec -it relay bash
以交互方式连接到您的中继容器,并尝试使用curl
ping 某些内容或加载页面。 If you want to do that automatically you can use healthcheck
.如果您想自动执行此操作,您可以使用
healthcheck
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.