diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-06 00:09:14 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-06 00:09:14 +0000 |
commit | c93374099a04d318af464f5b3a54a8aafdbca81f (patch) | |
tree | 9e4296521eb85a95a90d058982c30b922836eaa7 /doc/ci/docker | |
parent | 1bc5af76617026dec53016cb0881ec834ccab807 (diff) | |
download | gitlab-ce-c93374099a04d318af464f5b3a54a8aafdbca81f.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/ci/docker')
-rw-r--r-- | doc/ci/docker/using_docker_build.md | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/doc/ci/docker/using_docker_build.md b/doc/ci/docker/using_docker_build.md index 889dd9c4266..fbc8557fe39 100644 --- a/doc/ci/docker/using_docker_build.md +++ b/doc/ci/docker/using_docker_build.md @@ -362,13 +362,13 @@ Kubernetes: ##### Docker executor inside GitLab Runner configuration -If you are an administrator of GitLab Runner and you always want to use +If you are an administrator of GitLab Runner and you want to use the mirror for every `dind` service, update the [configuration](https://docs.gitlab.com/runner/configuration/advanced-configuration.html) to specify a [volume mount](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#volumes-in-the-runnersdocker-section). -Given we have a file `/opt/docker/daemon.json` with the following +For example, if you have a `/opt/docker/daemon.json` file with the following content: ```json @@ -379,7 +379,7 @@ content: } ``` -Update the `config.toml` for GitLab Runner to mount the file to +Update the `config.toml` file to mount the file to `/etc/docker/daemon.json`. This would mount the file for **every** container that is created by GitLab Runner. The configuration will be picked up by the `dind` service. @@ -394,7 +394,57 @@ picked up by the `dind` service. volumes = ["/opt/docker/daemon.json:/etc/docker/daemon.json:ro"] ``` -### Use Docker socket binding +##### Kubernetes executor inside GitLab Runner configuration + +> [Introduced](https://gitlab.com/gitlab-org/gitlab-runner/-/issues/3223) in GitLab Runner 13.6. + +If you are an administrator of GitLab Runner and you want to use +the mirror for every `dind` service, update the +[configuration](https://docs.gitlab.com/runner/configuration/advanced-configuration.html) +to specify a [ConfigMap volume +mount](https://docs.gitlab.com/runner/executors/kubernetes.html#using-volumes). + +For example, if you have a `/tmp/daemon.json` file with the following +content: + +```json +{ + "registry-mirrors": [ + "https://registry-mirror.example.com" + ] +} +``` + +Create a [ConfigMap](https://kubernetes.io/docs/concepts/configuration/configmap/) with the content +of this file. You can do this with a command like: + +```shell +kubectl create configmap docker-daemon --namespace gitlab-runner --from-file /tmp/daemon.json +``` + +NOTE: **Note:** +Make sure to use the namespace that GitLab Runner Kubernetes executor uses +to create job pods in. + +After the ConfigMap is created, you can update the `config.toml` +file to mount the file to `/etc/docker/daemon.json`. This update +mounts the file for **every** container that is created by GitLab Runner. +The configuration is picked up by the `dind` service. + +```toml +[[runners]] + ... + executor = "kubernetes" + [runners.kubernetes] + image = "alpine:3.12" + privileged = true + [[runners.kubernetes.volumes.config_map]] + name = "docker-daemon" + mount_path = "/etc/docker/daemon.json" + sub_path = "daemon.json" +``` + +#### Use Docker socket binding The third approach is to bind-mount `/var/run/docker.sock` into the container so that Docker is available in the context of that image. |