Authentication failed when running docker compose in cloud build

Viewed 13

Status: 404 Response:\nb\'"No service account scopes specified."\'',

I have a docker compose service that I want to run in cloud build. It runs successfully locally because I have env variable set to GOOGLE_APPLICATION_CREDENTIALS=sv-account-key.json with correct service account key file.

When running on cloud build:

  • My default cloud build service account has all required permissions. So when I run the code directly on cloud build (without docker compose) it works successfully and makes modifications to my cloud sql
  • When running through docker compose I get error Status: 404 Response:\nb\'"No service account scopes specified."\'',
  • I tried saving sv_account_key from secret manager as a local json file ( shown in code below) but I get error - not a valid json file. Is there a better way to authenticate containers ?
steps:
  - id: id-xyz
    name: gcr.io/cloud-builders/docker
    entrypoint: sh
    args:
      - -c
      - |
          printf "$$SV_ACCOUNT_KEY" > "sv-account-key.json"
          docker compose -f docker_files/dev-services.yaml run --rm run-cloud-build
    secretEnv: ['SV_ACCOUNT_KEY']
availableSecrets:
  secretManager:
  - versionName: projects/1123123/secrets/SV_ACCOUNT_KEY/versions/1
    env: 'SV_ACCOUNT_KEY'

options:
  logging: CLOUD_LOGGING_ONLY

timeout: 2400s
0 Answers
Related