Skip to content

GitLab CI command argument of services are ignored

Summary

Command argument of services seem to be ignored. I have configured the docker:dind service to use an insecure registry but the docker:dind service which is provisioned doesn't have it configured.

Steps to reproduce

Add this configuration to your .gitlab-ci.yml:

services:
- name: docker:dind
  command: ["--insecure-registry", "my-insecure-registry:5000"]

Actual behavior

No command is passed to the docker:dind container.

Expected behavior

Expecting --insecure-registry my-insecure-registry:5000 to be passed

Relevant logs and/or screenshots

Build logs:

Starting service docker:dind ...
Pulling docker image docker:dind ...
Waiting for services to be up and running...

docker inspect on the docker:dind container provided:

root@my-gitlab-machine:/# docker inspect runner-11426985-project-195-concurrent-0-docker
[
    {
        "Id": "50ccc230837b465446d69ecf90954a72346dc36d5c5f67403afde8ec280ad308",
        "Created": "2017-10-12T09:22:33.283854869Z",
        "Path": "dockerd-entrypoint.sh",
        "Args": [],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 7369,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2017-10-12T09:22:33.51243399Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:b9145b364a203c0afc538ca615b3470e41729edfb7338017f5d4eeb5b13b2d90",
        "ResolvConfPath": "/var/lib/docker/containers/50ccc230837b465446d69ecf90954a72346dc36d5c5f67403afde8ec280ad308/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/50ccc230837b465446d69ecf90954a72346dc36d5c5f67403afde8ec280ad308/hostname",
        "HostsPath": "/var/lib/docker/containers/50ccc230837b465446d69ecf90954a72346dc36d5c5f67403afde8ec280ad308/hosts",
        "LogPath": "/var/lib/docker/containers/50ccc230837b465446d69ecf90954a72346dc36d5c5f67403afde8ec280ad308/50ccc230837b465446d69ecf90954a72346dc36d5c5f67403afde8ec280ad308-json.log",
        "Name": "/runner-11426985-project-195-concurrent-0-docker",
        "RestartCount": 0,
        "Driver": "aufs",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "unconfined",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": null,
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": [
                "243361af9a0d4e519bb6100d7e8ec256908bded3bd868a7d2867c57e40b2a920"
            ],
            "CapAdd": null,
            "CapDrop": null,
            "Dns": null,
            "DnsOptions": null,
            "DnsSearch": null,
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": true,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": [
                "label=disable"
            ],
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": null,
            "DeviceCgroupRules": null,
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": -1,
            "OomKillDisable": false,
            "PidsLimit": 0,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0
        },
        "GraphDriver": {
            "Data": null,
            "Name": "aufs"
        },
        "Mounts": [
            {
                "Name": "7858e48aa70e4a3703660fccc2b74b3f9d72b3db77876a62165a05d0de744c43",
                "Source": "/var/lib/docker/volumes/7858e48aa70e4a3703660fccc2b74b3f9d72b3db77876a62165a05d0de744c43/_data",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            },
            {
                "Type": "volume",
                "Name": "fd87584e01c1326af95907aaba40ec12bb1b7797aad2776af4d62751f463db2f",
                "Source": "/var/lib/docker/volumes/fd87584e01c1326af95907aaba40ec12bb1b7797aad2776af4d62751f463db2f/_data",
                "Destination": "/var/lib/docker",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "50ccc230837b",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "2375/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "CI=true",
                "CI_DEBUG_TRACE=false",
                "CI_BUILD_REF=a3312994de743aaec761f518cf91be018b1a4c3d",
                "CI_BUILD_BEFORE_SHA=a3312994de743aaec761f518cf91be018b1a4c3d",
                "CI_BUILD_ID=17593",
                "CI_PROJECT_ID=195",
                "CI_SERVER=yes",
                "CI_SERVER_NAME=GitLab CI",
                "CI_SERVER_VERSION=",
                "CI_SERVER_REVISION=",
                "GITLAB_CI=true",
                "CI=true",
                "GITLAB_CI=true",
                "CI_SERVER_NAME=GitLab",
                "CI_SERVER_VERSION=9.5.2",
                "CI_SERVER_REVISION=ab97415",
                "CI_JOB_ID=17593",
                "CI_JOB_NAME=test-within-docker",
                "CI_JOB_STAGE=test",
                "CI_COMMIT_SHA=a3312994de743aaec761f518cf91be018b1a4c3d",
                "CI_REGISTRY_USER=gitlab-ci-token",
                "CI_BUILD_ID=17593",
                "CI_BUILD_REF=a3312994de743aaec761f518cf91be018b1a4c3d",
                "CI_BUILD_BEFORE_SHA=a3312994de743aaec761f518cf91be018b1a4c3d",
                "CI_BUILD_NAME=test-within-docker",
                "CI_BUILD_STAGE=test",
                "CI_PROJECT_ID=195",
                "CI_PIPELINE_ID=13900",
                "CI_CONFIG_PATH=.gitlab-ci.yml",
                "CI_RUNNER_ID=73",
                "CI_RUNNER_DESCRIPTION=Docker shared Gitlab runner",
                "CI_RUNNER_TAGS=",
                "DOCKER_DRIVER=aufs",
                "GITLAB_USER_ID=11",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "DOCKER_CHANNEL=stable",
                "DOCKER_VERSION=17.09.0-ce",
                "DIND_COMMIT=3b5fac462d21ca164b3778647420016315289034"
            ],
            "Cmd": [],
            "ArgsEscaped": true,
            "Image": "sha256:b9145b364a203c0afc538ca615b3470e41729edfb7338017f5d4eeb5b13b2d90",
            "Volumes": {
                "/var/lib/docker": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "dockerd-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {
                "com.gitlab.gitlab-runner.build.before_sha": "a3312994de743aaec761f518cf91be018b1a4c3d",
                "com.gitlab.gitlab-runner.build.id": "17593",
                "com.gitlab.gitlab-runner.build.sha": "a3312994de743aaec761f518cf91be018b1a4c3d",
                "com.gitlab.gitlab-runner.project.id": "195",
                "com.gitlab.gitlab-runner.runner.id": "11426985",
                "com.gitlab.gitlab-runner.runner.local_id": "0",
                "com.gitlab.gitlab-runner.service": "docker",
                "com.gitlab.gitlab-runner.service.version": "dind",
                "com.gitlab.gitlab-runner.type": "service"
            }
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "c5fd1fd09cc0ab848c521177e24fef6afd0e6f5e1b02d23d7d9c755afe53415a",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "2375/tcp": null
            },
            "SandboxKey": "/var/run/docker/netns/c5fd1fd09cc0",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "7147de26e0c8ab44d17095be274fc619ac1ea2372f9d2606776241ea8e3e4668",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.14",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:0e",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "f73f126306fe3ae0faeac3bd9b85d587ad6b22549f2fc55f76a445e1b2c4a242",
                    "EndpointID": "7147de26e0c8ab44d17095be274fc619ac1ea2372f9d2606776241ea8e3e4668",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.14",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:0e"
                }
            }
        }
    }
]

Environment description

GitLab version: Components GitLab 9.5.2

Used GitLab Runner version

gitlab-runner --version Version: 1.11.0 Git revision: 33af6569 Git branch: 1-11-stable GO version: go1.7.5 Built: Wed, 22 Feb 2017 15:57:56 +0000 OS/Arch: linux/amd64