Service command do not evaluate environment variable

Description

When using the gitlab ci together with gitlab docker registry some of us choose to use an insecure docker registry and this means when doing docker login we need to pass in a command line argument to allow us to do so. An example of .gitlab-ci.yml is like this:

image: docker:stable

stages:
  - build
  - test

variables:
  DOCKER_HOST: tcp://docker:2375/
  DOCKER_DRIVER: overlay2
  TEST_IMAGE: $CI_REGISTRY/bob/first-project:$CI_COMMIT_REF_SLUG
  RELEASE_IMAGE: $CI_REGISTRY/bob/first-project:latest

before_script:
  - echo $CI_REGISTRY
  - echo $CI_JOB_TOKEN
  - echo $CI_BUILD_TOKEN
  - echo $CI_COMMIT_REF_SLUG
  - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY

services:
  - name: docker:dind
    command: ["--insecure-registry=http://{internal-gitlab-url}:4567"]

Notice that we the option --insecure-registry=http://{internal-gitlab-url}:4567, here is the part I am having problem. I have to hard code the gitlab url we use internally, it is not a huge pain but if we want to change gitlab url it means for every project I have to change the url.

I have tried two things:

  1. to use command: ["--insecure-registry=http://$CI_REGISTRY"] and this appreantly does not work.
  2. create a new enviorment variable, DOCKER_DAEMON_ARGS: --insecure-registry=$CI_REGISTRY and then use command: [$DOCKER_DAEMON_ARGS], this does not work as either.

Proposal

Should we try to make either option 1 or 2 work?