The Plan
I want my tomcat server to be able to connect to my MySQL server both in separate containers.
The Problem
As you're linking db as "db", you cannot use localhost to join you database. you should "db"
jdbc:mysql://db:3306/tracker?useSSL=false
In your container, localhost design your tomcat container, not your host. MySQL container has his own network.
Futhermore, if you don't like "db" name, you can name link it with different name
For exemple:
links:
- db:container-mysql
In this case, inside you tomcat container, you could use
jdbc:mysql://container-mysql:3306/tracker?useSSL=false