Passing env variables to Docker images

How can I pass a secret string from Circle CI context to a Docker image? Example:

version: 2
jobs:
  build:
    docker:
      - image: circleci/node:8.11.2
      - image: gcr.io/cloudsql-docker/gce-proxy:1.11
        environment:
          SECRET: $SECRET
        command: ["sh", "-c", "echo $SECRET > /key.json && /cloud_sql_proxy"]

The code above doesn’t work. Is this a known bug?

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.