Keycloak Container on GAE with Cloud SQL (MySQL)

Hello, I have searched and searched to no avail. I have been able to add an external database to keycloak as long as both keycloak and mysql are containers and on the same network. My goal however is to have Keycloak launched on Google App Engine (in a container) and connected with Google Cloud SQL (an external MySQL instance).

My issue is that I am getting “Failed to Connect to Database” (see below) no matter which database I use. I even installed MySQL 5.7 on my local machine to test. Also tried Postgres. Same thing. How do I keep Keycloak in a container but still be able to use an external database that is not in a container?

FATAL [] (ServerService Thread Pool – 68) java.lang.RuntimeException: Failed to connect to database

Thank you in advance!

Be sure you provided correct env variables for DB connection in Dockerfile.
With unprotected DB connection worked by default. But I had similar issue using production database on Cloud SQL which is protected. I had to use cloud sql proxy with configured tcp port as described in docs below.
for App Engine standard:

in my case it was App Engine flex: