Based on the error message, it does appear there is a missing secret perhaps due to how volumes are mounted.
Please consult this docker file structure guide, then carefully follow the steps in our guide on how to connect to a Cloud SQL proxy.
If the issue persists, I suggest opening a support case (include the docs you have been using as guide, as well as the solutions you have tried so far) so GCP support can look into this further.
On Thursday, November 11, 2021 at 12:03:34 PM UTC-5 just...@gmail.com wrote:
For what it's worth in the cloud_sql_proxy command in the first container I do include the file name "credentials.json" just forget to include it hereOn Thursday, November 11, 2021 at 11:42:37 AM UTC-5 Justis Gipson wrote:Learning as I go here, but ran into an issue running the cloud_sql_proxy from a compose file.
`cloudsql-proxy | 2021/11/11 15:57:39 invalid json file "app/secrets/cloudsql/credentials.json": open app/secrets/cloudsql/credentials.json: no such file or directory`
The error is only occurring when ran from in the docker-compose file. When I run it locally it works as expected.
I have a feeling it's how the volumes are mounted, but I am not sure at this point.
I've tried everything I have read in the docs, GCP Slack community & StackOverflow - nothing has helped.
Here's my compose:version: '3'services:# Gonna have to figure this out...#cloudsql-proxy:container_name: cloudsql-proxyenv_file:- ./.dev.envrestart: alwaysvolumes:- credentials:/appports:- 5432:5432command: /cloud_sql_proxy -credential_file=app/secrets/cloudsql/ -instances=XXPROJECT_IDXX:XXREGIONXX:XXDB_NAMEXX=tcp:0.0.0.0:5432 &# depends_on:# - feathersfeathers:build:context: .dockerfile: dockerfilerestart: alwaysworking_dir: /appvolumes:- ./:/app- node_modules_cache:/app/node_modules/ports:- 3030:3030env_file:- ./.dev.envcommand: 'npm run dev'depends_on:- cloudsql-proxyvolumes:credentials:node_modules_cache:Any insight into why the compose file is telling me the json is invalid would be helpful.
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/0ad02e1c-9c08-4723-b10f-6518145fa0f5n%40googlegroups.com.
No comments:
Post a Comment