Some container labels have double prefix

Summary

Some container labels have doulbe prefix com.gitlab.gitlab-runner.com.gitlab.gitlab-runner. It seems to be related to changes in !4913 (merged)

Steps to reproduce

Search for identifier of container with service by label com.gitlab.gitlab-runner.service using --filter option for docker command.

.gitlab-ci.yml
failed_job:
  image: docker:24.0-cli
  
  services:
    - postgres:15-alpine
  
  script:
    - export POSTGRES_CONTAINER_ID=$(docker ps -q
      -f "label=com.gitlab.gitlab-runner.job.id=$CI_JOB_ID"
      -f "label=com.gitlab.gitlab-runner.service=postgres")
    - docker exec $POSTGRES_CONTAINER_ID psql
      -U "${POSTGRES_USER}"
      -d "${POSTGRES_DB}"
      -c "CREATE EXTENSION IF NOT EXISTS btree_gin;"

Actual behavior

Job failed with error:

Error response from daemon: No such container: psql

Expected behavior

Job should be passed.

Relevant logs and/or screenshots

Docker inspect show that some labels have double prefix.

docker inspect
[
    {
        "Id": "e6f70e5964e321d999dc537f35a9336c481d8dec7d2eeaecb428d69c09e2b433",
        "Created": "2025-03-18T13:48:08.185270116Z",
        "Path": "docker-entrypoint.sh",
        "Args": [
            "postgres"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 233331,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2025-03-18T13:48:08.309118995Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Config": {
            ...
            "Labels": {
                "com.gitlab.gitlab-runner.com.gitlab.gitlab-runner.job.before_sha": "b2187eec7757bf5c63dfa35861258ceae7d1aed0",
                "com.gitlab.gitlab-runner.com.gitlab.gitlab-runner.job.id": "38951",
                "com.gitlab.gitlab-runner.com.gitlab.gitlab-runner.job.ref": "dev",
                "com.gitlab.gitlab-runner.com.gitlab.gitlab-runner.job.sha": "f53637ece1daeef397b63dea43a334c69bb1c153",
                "com.gitlab.gitlab-runner.com.gitlab.gitlab-runner.job.url": "<censored>",
                "com.gitlab.gitlab-runner.com.gitlab.gitlab-runner.managed": "true",
                "com.gitlab.gitlab-runner.com.gitlab.gitlab-runner.pipeline.id": "9057",
                "com.gitlab.gitlab-runner.com.gitlab.gitlab-runner.project.id": "32",
                "com.gitlab.gitlab-runner.com.gitlab.gitlab-runner.runner.id": "nyoBo7zui",
                "com.gitlab.gitlab-runner.com.gitlab.gitlab-runner.runner.local_id": "0",
                "com.gitlab.gitlab-runner.com.gitlab.gitlab-runner.service": "postgres",
                "com.gitlab.gitlab-runner.com.gitlab.gitlab-runner.service.version": "15-alpine",
                "com.gitlab.gitlab-runner.com.gitlab.gitlab-runner.type": "service",
                "com.gitlab.gitlab-runner.job.before_sha": "b2187eec7757bf5c63dfa35861258ceae7d1aed0",
                "com.gitlab.gitlab-runner.job.id": "38951",
                "com.gitlab.gitlab-runner.job.ref": "dev",
                "com.gitlab.gitlab-runner.job.sha": "f53637ece1daeef397b63dea43a334c69bb1c153",
                "com.gitlab.gitlab-runner.job.url": "<censored>",
                "com.gitlab.gitlab-runner.managed": "true",
                "com.gitlab.gitlab-runner.pipeline.id": "9057",
                "com.gitlab.gitlab-runner.project.id": "32",
                "com.gitlab.gitlab-runner.runner.id": "nyoBo7zui",
                "com.gitlab.gitlab-runner.runner.local_id": "0"
            }
        },
        ...
    }
]

Used GitLab Runner version

Version:      17.9.1
Git revision: bbf75488
Git branch:   17-9-stable
GO version:   go1.23.2 X:cacheprog
Built:        2025-03-07T23:57:02Z
OS/Arch:      linux/amd64