Home > Blockchain >  Docker compose container behind nginx proxy cannot access internet
Docker compose container behind nginx proxy cannot access internet

Time:10-03

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.

I have the following 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. 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. My intuition is that the sentry relay server is unable to access the internet to verify the project id as real, so it tries to look for local project ids, of which there are none.

How can I make sure my relay container can connect to external networks like sentry.io?

CodePudding user response:

Connect to your relay container interactively with docker exec -it relay bash and try to ping something or load a page with curl. If you want to do that automatically you can use healthcheck.

  • Related