Google Cloud Build yaml docker environment variable

Published

I am trying to set an environment variable in a docker image via a cloudbuild.yaml for Google Cloud Build

Here is the sample cloudbuild.yaml:

steps:
      - name: "gcr.io/cloud-builders/docker"
        args: ["run", "--rm", "--volume=/foo:/bar", "--privileged", "-e FOO=bar", "my/build:latest", "/root/init_build.sh" ]
timeout: "600s"

When I run on the command line locally and pass the environment variables into the container, it works as expected. However, when I trigger a build in Cloud Build, the environment variable doesn’t get set in the container.

Thank you in advance for any guidance.

Source: Docker Questions

Answers

Leave a Reply

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq