简体   繁体   中英

Google cloud error when deploying container: environment variable is missing

When trying to deploy my docker container to Google cloud I got the error (RuntimeError) environment variable DATABASE_URL is missing. even though I had successfully set the DATABASE_URL variable using the instructions here .

This error happens after I run the command gcloud run deploy --image gcr.io/PROJECT-ID/backend --platform managed any help would be greatly appreciated.

You will need to set environment variables for Cloud Run gcloud run... , using the instructions here:

https://cloud.google.com/sdk/gcloud/reference/run/deploy#--set-env-vars

Something of the form:

gcloud run deploy ${NAME} \
--image=gcr.io/${PROJECT-ID} \
--set-env-vars=DATABASE_URL="[[DATABASE-URL]]" \
...

The instructions you reference are for Cloud Composer which is a different Google service and it has different requirements.

If you'd like a more specific answer, please include more details about what you're trying to do, how you do it (please include commands that you used) and what happened (please include the output|errors from the commands).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM