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"