Can't connect to database with hostname but works with IP

runtracc a year ago

Hi guys, my installation works perfectly on my local virtual box, but fails on VPS. Everything is the same just on VPS I can't connect to database with container hostname. When I use container IP in config file it connects? What can be the issue?

2024-11-05 21:11:16  INFO: Operating system name: Linux version: 4.4.0 architecture: amd64
2024-11-05 21:11:16  INFO: Java runtime name: OpenJDK 64-Bit Server VM vendor: Alpine version: 17.0.12+7-alpine-r0
2024-11-05 21:11:16  INFO: Memory limit heap: 1024mb non-heap: 0mb
2024-11-05 21:11:16  INFO: Character encoding: UTF-8
2024-11-05 21:11:16  INFO: Version: 6.5
2024-11-05 21:11:16  INFO: Starting server...
2024-11-05 21:11:16  INFO: HikariPool-1 - Starting...
2024-11-05 21:11:27 ERROR: Main method error - demodb - UnknownHostException (... < DatabaseModule:80 < <gener:-1 < *:-1 < ... < MainModule:138 < <gener:-1 < ...)
2024-11-05 21:11:29  INFO: Operating system name: Linux version: 4.4.0 architecture: amd64
2024-11-05 21:11:29  INFO: Java runtime name: OpenJDK 64-Bit Server VM vendor: Alpine version: 17.0.12+7-alpine-r0
2024-11-05 21:11:29  INFO: Memory limit heap: 1024mb non-heap: 0mb
2024-11-05 21:11:29  INFO: Character encoding: UTF-8
2024-11-05 21:11:29  INFO: Version: 6.5
2024-11-05 21:11:29  INFO: Starting server...
2024-11-05 21:11:29  INFO: HikariPool-1 - Starting...
Anton Tananaev a year ago

How do you expect the hostname to be resolved?

runtracc a year ago

All containers are on the same bridge network it should be through docker native DNS system? It works in my local testing env

Anton Tananaev a year ago

It clearly doesn't work. And it doesn't seem to be specific to Traccar. Simply hostname resolution is failing.

runtracc a year ago

Strange, I literally run the same script from scratch in my local env and VPS. Can it be something with VPS provider?

runtracc a year ago

This was VPS hosting issue. Resolved, ty!