0

I'm trying to run a TeamCity in a Docker Swarm but it can not authenticate with the external AWS RDS Postgres instance. The strange part to me is that this issue does not occur when running as docker-compose. I've run this locally and on an AWS EC2 to double check that it is not related to something going on with the machine. Both times I get the same results.

The error message is:

Could not connect to PostgreSQL server. the connection attempt failed.: org.postgresql.util.PSQLException: The connection attempt failed. Caused by: java.net.UnknownHostException: rds_url.com

docker-compose.yaml:

version: "3"

services:
  teamcity-server:
    privileged: true
    image: jetbrains/teamcity-server:2020.2.2
    hostname: teamcity-server
    ports:
      - "8111:8111"
      - "5432:5432"
    volumes:
      - ./data_dir:/data/teamcity_server/datadir
      - ./log_dir:/opt/teamcity/logs
    

  teamcity-agent:
    privileged: true
    image: jetbrains/teamcity-agent:2020.2.2
    environment:
      - SERVER_URL=http://teamcity-server:8111
      - AGENT_NAME=regular_agent
      - DOCKER_IN_DOCKER=start
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"


  teamcity-minimal-agent:
    privileged: true
    image: jetbrains/teamcity-minimal-agent:2020.2.2
    environment:
      - SERVER_URL=http://teamcity-server:8111
      - AGENT_NAME=minimal_agent
      - DOCKER_IN_DOCKER=start
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
Bill--
  • 140
  • 3
  • 6

1 Answers1

0

Talking with TeamCity support I was able to figure it out. In short I needed to set the DNS server to the VPC DNS server. I also set the network mode to host.

dns: 169.254.169.253
network_mode: host

Locally I never solved it. To hit my rds server I need to be on a VPN and docker swarm was unable to resolve the IP address with the vpn running.

Bill--
  • 140
  • 3
  • 6