Docker Compose - Flyway - Unable to obtain Jdbc connection from DataSource
Issue
In this lineGRANT ALL PRIVILEGES ON base.* To 'user'@'localhost';
you grant priviledges to user on localhost
but your service1
and flyaway-service-1
services are running in their own separate containers and therefore are not running on localhost
(with respect to the mysqldb
container). If these services were running inside the mysqldb
container then maybe they could be running on localhost
.
Possible Resolution?
You may want to try using the hostname of the services/containers you're granting access to instead of localhost
?
ie : GRANT ALL PRIVILEGES ON base.* To 'user'@'service1';
Docker Networks instead of Container Links
Also, I would suggest using Docker's new networking feature instead of the legacy container linking method. See rationale behind docker compose "links" order