Trying to run google cloud emulator in pipeline: "FATAL: No HOST or PORT found"

Replace this template with your information

Describe your question in as much detail as possible:

I’m trying to run the Google datastore emulator using the google/cloud-sdk docker as a service.
The same docker command used on the CI works locally.

  • What are you seeing, and how does that differ from what you expect to see?

I expect to see the emulator running on port 8080.

  • Consider including screenshots, error messages, and/or other helpful visuals

Here’s a snippet from the log

*** WARNING: Service runner--azerasq-project-26594908-concurrent-0-aababf5d82e87691-google__cloud-sdk-0 probably didn't start properly.
Health check error:
service "runner--azerasq-project-26594908-concurrent-0-aababf5d82e87691-google__cloud-sdk-0-wait-for-service" health check: exit code 1
Health check container logs:
2021-11-25T15:49:31.057994970Z FATAL: No HOST or PORT found                      
Service container logs:
2021-11-25T15:49:30.783697828Z Executing: /usr/lib/google-cloud-sdk/platform/cloud-datastore-emulator/cloud_datastore_emulator create --project_id=gitlab-ci-plan-free-5-6ef84d /root/.config/gcloud/emulators/datastore
*********
  • What version are you on? Are you using self-managed or GitLab.com?
    gitlab.com

  • Add the CI configuration from .gitlab-ci.yml and other configuration if relevant (e.g. docker-compose.yml)

image: python:3.9-slim

# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"

# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
cache:
  paths:
    - .cache/pip

variables:
  DATASTORE_DATASET: project-007
  DATASTORE_EMULATOR_HOST: google-cloud-sdk:8081
  DATASTORE_EMULATOR_HOST_PATH: google-cloud-sdk:8081/datastore
  DATASTORE_HOST: http://google-cloud-sdk:8081
  DATASTORE_PROJECT_ID: project-007

before_script:
  - apt-get update && apt-get install -y ffmpeg make 
  - python --version  # Print out python version for debugging
  - cd backend
  - python -m pip install -r dev-requirements.txt

test:
  services:
    - name: google/cloud-sdk:latest
      command: ["gcloud", "beta", "emulators", "datastore", "start", "--host-port", "0.0.0.0:8080"]
      variables:
        CLOUDSDK_CORE_PROJECT: project-007
  script:
    - make test

  • What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?

I’ve look at docker names, try both the versions with __ and with -.

Solution here