Container access to gcloud credentials denied

Viewed 1004

I'm trying to implement the container that converts data from HL7 to FHIR (https://github.com/GoogleCloudPlatform/healthcare/tree/master/ehr/hl7/message_converter/java) on Google Cloud. However, I can't build the container, locally, on my machine, to later deploy to the cloud.

The error that occurs is always in the authentication part of the credentials when I try to rotate the image locally using the docker:

docker run --network=host -v ~/.config:/root/.config hl7v2_to_fhir_converter 
/healthcare/bin/healthcare --fhirProjectId=<PROJECT_ID> --fhirLocationId=<LOCATION_ID> -- 
fhirDatasetId=<DATASET_ID> --fhirStoreId=<STORE_ID> --pubsubProjectId=<PUBSUB_PROJECT_ID> -- 
pubsubSubscription=<PUBSUB_SUBSCRIPTION_ID> --apiAddrPrefix=<API_ADDR_PREFIX>

I am using Windows and have already performed the command below to create the credentials:

gcloud auth application-default login

The credential, after executing the above command, is saved in:

C:\Users\XXXXXX\AppData\Roaming\gcloud\application_default_credentials.json

The command -v ~ / .config: /root/.config is supposed to enable the docker to search for the credential when running the image, but it does not. The error that occurs is:

The Application Default Credentials are not available. They are available if running in Google 
Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined 
pointing to a file defining the credentials. See 
https://developers.google.com/accounts/docs/application-default-credentials for more information.

What am I putting error on?

Thanks,

1 Answers

A container runs isolated to the rest of the system, it's its strength and that's why this packaging method is so popular.

Thus, all the configuration on your environment is void if you don't pass it to the container runtime environment, like the GOOGLE_APPLICATION_CREDENTIALS env var.

I wrote an article on this. Let me know if it helps, and, if not, we will discussed the blocking point!

Related