Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'doc/ci/docker')
-rw-r--r--doc/ci/docker/using_docker_build.md243
-rw-r--r--doc/ci/docker/using_docker_images.md588
2 files changed, 209 insertions, 622 deletions
diff --git a/doc/ci/docker/using_docker_build.md b/doc/ci/docker/using_docker_build.md
index 2091a80bdf2..90a33478239 100644
--- a/doc/ci/docker/using_docker_build.md
+++ b/doc/ci/docker/using_docker_build.md
@@ -31,9 +31,9 @@ to learn more about how these runners are configured.
### Use the shell executor
-You can include Docker commands in your CI/CD jobs if your runner is configured to
-use the `shell` executor. The `gitlab-runner` user runs the Docker commands, but
-needs permission to run them.
+To include Docker commands in your CI/CD jobs, you can configure your runner to
+use the `shell` executor. In this configuration, the `gitlab-runner` user runs
+the Docker commands, but needs permission to do so.
1. [Install](https://gitlab.com/gitlab-org/gitlab-runner/#installation) GitLab Runner.
1. [Register](https://docs.gitlab.com/runner/register/) a runner.
@@ -81,76 +81,69 @@ Learn more about the [security of the `docker` group](https://blog.zopyx.com/on-
### Use the Docker executor with the Docker image (Docker-in-Docker)
-You can use "Docker-in-Docker" to run commands in your CI/CD jobs:
+"Docker-in-Docker" (`dind`) means:
-- Register a runner that uses the Docker executor.
-- Use the [Docker image](https://hub.docker.com/_/docker/) provided by Docker to
- run the jobs that need Docker commands.
+- Your registered runner uses the [Docker executor](https://docs.gitlab.com/runner/executors/docker.html).
+- The executor uses a [container image of Docker](https://hub.docker.com/_/docker/), provided
+ by Docker, to run your CI/CD jobs.
-The Docker image has all of the `docker` tools installed
-and can run the job script in context of the image in privileged mode.
+The Docker image has all of the `docker` tools installed and can run
+the job script in context of the image in privileged mode.
-The `docker-compose` command is not available in this configuration by default.
-To use `docker-compose` in your job scripts, follow the `docker-compose`
-[installation instructions](https://docs.docker.com/compose/install/).
+We recommend you use [Docker-in-Docker with TLS enabled](#docker-in-docker-with-tls-enabled),
+which is supported by [GitLab.com shared runners](../../user/gitlab_com/index.md#shared-runners).
-An example project that uses this approach can be found here: <https://gitlab.com/gitlab-examples/docker>.
-
-WARNING:
-When you enable `--docker-privileged`, you are effectively disabling all of
-the security mechanisms of containers and exposing your host to privilege
-escalation. Doing this can lead to container breakout. For more information, check
-out the official Docker documentation on
-[runtime privilege and Linux capabilities](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities).
+You should always specify a specific version of the image, like `docker:19.03.12`.
+If you use a tag like `docker:stable`, you have no control over which version is used.
+Unpredictable behavior can result, especially when new versions are released.
#### Limitations of Docker-in-Docker
-Docker-in-Docker is the recommended configuration, but it is
+Docker-in-Docker is the recommended configuration, but is
not without its own challenges:
-- When using Docker-in-Docker, each job is in a clean environment without the past
- history. Concurrent jobs work fine because every build gets its own
- instance of Docker engine so they don't conflict with each other. But this
- also means that jobs can be slower because there's no caching of layers.
-- By default, Docker 17.09 and higher uses `--storage-driver overlay2` which is
- the recommended storage driver. See [Using the OverlayFS driver](#use-the-overlayfs-driver)
- for details.
-- Since the `docker:19.03.12-dind` container and the runner container don't share their
- root file system, the job's working directory can be used as a mount point for
+- **The `docker-compose` command**: This command is not available in this configuration by default.
+ To use `docker-compose` in your job scripts, follow the `docker-compose`
+ [installation instructions](https://docs.docker.com/compose/install/).
+- **Cache**: Each job runs in a new environment. Concurrent jobs work fine,
+ because every build gets its own instance of Docker engine and they don't conflict with each other.
+ However, jobs can be slower because there's no caching of layers.
+- **Storage drivers**: By default, earlier versions of Docker use the `vfs` storage driver,
+ which copies the file system for each job. Docker 17.09 and later use `--storage-driver overlay2`, which is
+ the recommended storage driver. See [Using the OverlayFS driver](#use-the-overlayfs-driver) for details.
+- **Root file system**: Because the `docker:19.03.12-dind` container and the runner container don't share their
+ root file system, you can use the job's working directory as a mount point for
child containers. For example, if you have files you want to share with a
- child container, you may create a subdirectory under `/builds/$CI_PROJECT_PATH`
- and use it as your mount point (for a more thorough explanation, check [issue
- #41227](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/41227)):
+ child container, you might create a subdirectory under `/builds/$CI_PROJECT_PATH`
+ and use it as your mount point. For a more detailed explanation, view [issue
+ #41227](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/41227).
```yaml
variables:
MOUNT_POINT: /builds/$CI_PROJECT_PATH/mnt
-
script:
- mkdir -p "$MOUNT_POINT"
- docker run -v "$MOUNT_POINT:/mnt" my-docker-image
```
-In the examples below, we are using Docker images tags to specify a
-specific version, such as `docker:19.03.12`. If tags like `docker:stable`
-are used, you have no control over what version is used. This can lead to
-unpredictable behavior, especially when new versions are
-released.
+#### Docker-in-Docker with TLS enabled
-#### TLS enabled
+> Introduced in GitLab Runner 11.11.
-The Docker daemon supports connection over TLS and it's done by default
-for Docker 19.03.12 or higher. This is the **suggested** way to use the
-Docker-in-Docker service and
-[GitLab.com shared runners](../../user/gitlab_com/index.md#shared-runners)
-support this.
+The Docker daemon supports connections over TLS. In Docker 19.03.12 and later,
+TLS is the default.
-##### Docker
+WARNING:
+This task enables `--docker-privileged`. When you do this, you are effectively disabling all of
+the security mechanisms of containers and exposing your host to privilege
+escalation. Doing this can lead to container breakout. For more information,
+see the official Docker documentation about
+[runtime privilege and Linux capabilities](https://docs.docker.com/engine/reference/run/#runtime-privilege-and-linux-capabilities).
-> Introduced in GitLab Runner 11.11.
+To use Docker-in-Docker with TLS enabled:
1. Install [GitLab Runner](https://docs.gitlab.com/runner/install/).
-1. Register GitLab Runner from the command line to use `docker` and `privileged`
+1. Register GitLab Runner from the command line. Use `docker` and `privileged`
mode:
```shell
@@ -164,18 +157,16 @@ support this.
--docker-volumes "/certs/client"
```
- The above command registers a new runner to use the special
- `docker:19.03.12` image, which is provided by Docker. **Notice that it's
- using the `privileged` mode to start the build and service
- containers.** If you want to use [Docker-in-Docker](https://www.docker.com/blog/docker-can-now-run-within-docker/) mode, you always
- have to use `privileged = true` in your Docker containers.
-
- This also mounts `/certs/client` for the service and build
- container, which is needed for the Docker client to use the
- certificates inside of that directory. For more information on how
- Docker with TLS works, check <https://hub.docker.com/_/docker/#tls>.
+ - This command registers a new runner to use the `docker:19.03.12` image.
+ To start the build and service containers, it uses the `privileged` mode.
+ If you want to use [Docker-in-Docker](https://www.docker.com/blog/docker-can-now-run-within-docker/),
+ you must always use `privileged = true` in your Docker containers.
+ - This command mounts `/certs/client` for the service and build
+ container, which is needed for the Docker client to use the
+ certificates in that directory. For more information on how
+ Docker with TLS works, see <https://hub.docker.com/_/docker/#tls>.
- The above command creates a `config.toml` entry similar to this:
+ The previous command creates a `config.toml` entry similar to this:
```toml
[[runners]]
@@ -193,14 +184,14 @@ support this.
[runners.cache.gcs]
```
-1. You can now use `docker` in the build script (note the inclusion of the
- `docker:19.03.12-dind` service):
+1. You can now use `docker` in the job script. Note the inclusion of the
+ `docker:19.03.12-dind` service:
```yaml
image: docker:19.03.12
variables:
- # When using dind service, we need to instruct docker to talk with
+ # When you use the dind service, you must instruct Docker to talk with
# the daemon started inside of the service. The daemon is available
# with a network connection instead of the default
# /var/run/docker.sock socket. Docker 19.03 does this automatically
@@ -210,9 +201,9 @@ support this.
# The 'docker' hostname is the alias of the service container as described at
# https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services.
#
- # Specify to Docker where to create the certificates, Docker will
- # create them automatically on boot, and will create
- # `/certs/client` that will be shared between the service and job
+ # Specify to Docker where to create the certificates. Docker
+ # creates them automatically on boot, and creates
+ # `/certs/client` to share between the service and job
# container, thanks to volume mount from config.toml
DOCKER_TLS_CERTDIR: "/certs"
@@ -229,10 +220,12 @@ support this.
- docker run my-docker-image /script/to/run/tests
```
-##### Kubernetes
+#### Docker-in-Docker with TLS enabled in Kubernetes
> [Introduced](https://gitlab.com/gitlab-org/charts/gitlab-runner/-/issues/106) in GitLab Runner Helm Chart 0.23.0.
+To use Docker-in-Docker with TLS enabled in Kubernetes:
+
1. Using the
[Helm chart](https://docs.gitlab.com/runner/install/kubernetes.html), update the
[`values.yml` file](https://gitlab.com/gitlab-org/charts/gitlab-runner/-/blob/00c1a2098f303dffb910714752e9a981e119f5b5/values.yaml#L133-137)
@@ -251,14 +244,14 @@ support this.
medium = "Memory"
```
-1. You can now use `docker` in the build script (note the inclusion of the
- `docker:19.03.13-dind` service):
+1. You can now use `docker` in the job script. Note the inclusion of the
+ `docker:19.03.13-dind` service:
```yaml
image: docker:19.03.13
variables:
- # When using dind service, we need to instruct docker to talk with
+ # When using dind service, you must instruct Docker to talk with
# the daemon started inside of the service. The daemon is available
# with a network connection instead of the default
# /var/run/docker.sock socket.
@@ -271,9 +264,9 @@ support this.
# Kubernetes executor connects services to the job container
# DOCKER_HOST: tcp://localhost:2376
#
- # Specify to Docker where to create the certificates, Docker will
- # create them automatically on boot, and will create
- # `/certs/client` that will be shared between the service and job
+ # Specify to Docker where to create the certificates. Docker
+ # creates them automatically on boot, and creates
+ # `/certs/client` to share between the service and job
# container, thanks to volume mount from config.toml
DOCKER_TLS_CERTDIR: "/certs"
# These are usually specified by the entrypoint, however the
@@ -295,9 +288,9 @@ support this.
- docker run my-docker-image /script/to/run/tests
```
-#### TLS disabled
+#### Docker-in-Docker with TLS disabled
-Sometimes there are legitimate reasons why you might want to disable TLS.
+Sometimes you might have legitimate reasons to disable TLS.
For example, you have no control over the GitLab Runner configuration
that you are using.
@@ -319,14 +312,14 @@ Assuming that the runner's `config.toml` is similar to:
[runners.cache.gcs]
```
-You can now use `docker` in the build script (note the inclusion of the
-`docker:19.03.12-dind` service):
+You can now use `docker` in the job script. Note the inclusion of the
+`docker:19.03.12-dind` service:
```yaml
image: docker:19.03.12
variables:
- # When using dind service we need to instruct docker, to talk with the
+ # When using dind service, you must instruct docker to talk with the
# daemon started inside of the service. The daemon is available with
# a network connection instead of the default /var/run/docker.sock socket.
#
@@ -340,7 +333,7 @@ variables:
#
DOCKER_HOST: tcp://docker:2375
#
- # This will instruct Docker not to start over TLS.
+ # This instructs Docker not to start over TLS.
DOCKER_TLS_CERTDIR: ""
services:
@@ -382,10 +375,10 @@ To make Docker available in the context of the image:
--docker-volumes /var/run/docker.sock:/var/run/docker.sock
```
- This command registers a new runner to use the special
- `docker:19.03.12` image, which is provided by Docker. **The command uses
+ This command registers a new runner to use the
+ `docker:19.03.12` image provided by Docker. The command uses
the Docker daemon of the runner itself. Any containers spawned by Docker
- commands are siblings of the runner rather than children of the runner.**
+ commands are siblings of the runner rather than children of the runner.
This may have complications and limitations that are unsuitable for your workflow.
Your `config.toml` file should now have an entry like this:
@@ -405,7 +398,7 @@ To make Docker available in the context of the image:
Insecure = false
```
-1. Use `docker` in the build script. You don't need to
+1. Use `docker` in the job script. You don't need to
include the `docker:19.03.12-dind` service, like you do when you're using
the Docker-in-Docker executor:
@@ -445,20 +438,20 @@ the implications of this method are:
When the Docker daemon starts inside of the service container, it uses
the default configuration. You may want to configure a [registry
mirror](https://docs.docker.com/registry/recipes/mirror/) for
-performance improvements and ensuring you don't reach DockerHub rate limits.
+performance improvements and to ensure you don't reach Docker Hub rate limits.
-##### Inside `.gitlab-ci.yml`
+##### The service in the `.gitlab-ci.yml` file
You can append extra CLI flags to the `dind` service to set the registry
mirror:
```yaml
services:
- - name: docker:19.03.13-dind
- command: ["--registry-mirror", "https://registry-mirror.example.com"] # Specify the registry mirror to use.
+ - name: docker:19.03.13-dind
+ command: ["--registry-mirror", "https://registry-mirror.example.com"] # Specify the registry mirror to use
```
-##### DinD service defined inside of GitLab Runner configuration
+##### The service in the GitLab Runner configuration file
> [Introduced](https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27173) in GitLab Runner 13.6.
@@ -495,7 +488,7 @@ Kubernetes:
command = ["--registry-mirror", "https://registry-mirror.example.com"]
```
-##### Docker executor inside GitLab Runner configuration
+##### The Docker executor in the GitLab Runner configuration file
If you are a GitLab Runner administrator, you can use
the mirror for every `dind` service. Update the
@@ -528,7 +521,7 @@ picked up by the `dind` service.
volumes = ["/opt/docker/daemon.json:/etc/docker/daemon.json:ro"]
```
-##### Kubernetes executor inside GitLab Runner configuration
+##### The Kubernetes executor in the GitLab Runner configuration file
> [Introduced](https://gitlab.com/gitlab-org/gitlab-runner/-/issues/3223) in GitLab Runner 13.6.
@@ -556,7 +549,7 @@ kubectl create configmap docker-daemon --namespace gitlab-runner --from-file /tm
```
NOTE:
-Make sure to use the namespace that GitLab Runner Kubernetes executor uses
+Make sure to use the namespace that the GitLab Runner Kubernetes executor uses
to create job pods in.
After the ConfigMap is created, you can update the `config.toml`
@@ -577,15 +570,15 @@ The configuration is picked up by the `dind` service.
sub_path = "daemon.json"
```
-## Authenticating with registry in Docker-in-Docker
+## Authenticate with registry in Docker-in-Docker
-When you use Docker-in-Docker, the [normal authentication
-methods](using_docker_images.html#define-an-image-from-a-private-container-registry)
+When you use Docker-in-Docker, the
+[standard authentication methods](using_docker_images.md#define-an-image-from-a-private-container-registry)
don't work because a fresh Docker daemon is started with the service.
### Option 1: Run `docker login`
-In [`before_script`](../yaml/README.md#before_script) run `docker
+In [`before_script`](../yaml/README.md#before_script), run `docker
login`:
```yaml
@@ -618,12 +611,12 @@ are using the official `docker:19.03.13` image, the home directory is
under `/root`.
If you mount the configuration file, any `docker` command
-that modifies the `~/.docker/config.json` (for example, `docker login`)
+that modifies the `~/.docker/config.json` fails. For example, `docker login`
fails, because the file is mounted as read-only. Do not change it from
read-only, because problems occur.
Here is an example of `/opt/.docker/config.json` that follows the
-[`DOCKER_AUTH_CONFIG`](using_docker_images.md#determining-your-docker_auth_config-data)
+[`DOCKER_AUTH_CONFIG`](using_docker_images.md#determine-your-docker_auth_config-data)
documentation:
```json
@@ -638,8 +631,8 @@ documentation:
#### Docker
-Update the [volume
-mounts](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#volumes-in-the-runnersdocker-section)
+Update the
+[volume mounts](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#volumes-in-the-runnersdocker-section)
to include the file.
```toml
@@ -661,8 +654,7 @@ of this file. You can do this with a command like:
kubectl create configmap docker-client-config --namespace gitlab-runner --from-file /opt/.docker/config.json
```
-Update the [volume
-mounts](https://docs.gitlab.com/runner/executors/kubernetes.html#using-volumes)
+Update the [volume mounts](https://docs.gitlab.com/runner/executors/kubernetes.html#using-volumes)
to include the file.
```toml
@@ -683,21 +675,19 @@ to include the file.
### Option 3: Use `DOCKER_AUTH_CONFIG`
If you already have
-[`DOCKER_AUTH_CONFIG`](using_docker_images.md#determining-your-docker_auth_config-data)
+[`DOCKER_AUTH_CONFIG`](using_docker_images.md#determine-your-docker_auth_config-data)
defined, you can use the variable and save it in
`~/.docker/config.json`.
-There are multiple ways to define this. For example:
+There are multiple ways to define this authentication:
-- Inside
- [`pre_build_script`](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runners-section)
- inside of the runner configuration file.
-- Inside [`before_script`](../yaml/README.md#before_script).
-- Inside of [`script`](../yaml/README.md#script).
+- In [`pre_build_script`](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runners-section)
+ in the runner configuration file.
+- In [`before_script`](../yaml/README.md#before_script).
+- In [`script`](../yaml/README.md#script).
-Below is an example of
-[`before_script`](../yaml/README.md#before_script). The same commands
-apply for any solution you implement.
+The following example shows [`before_script`](../yaml/README.md#before_script).
+The same commands apply for any solution you implement.
```yaml
image: docker:19.03.13
@@ -718,10 +708,10 @@ build:
- docker run my-docker-image /script/to/run/tests
```
-## Making Docker-in-Docker builds faster with Docker layer caching
+## Make Docker-in-Docker builds faster with Docker layer caching
When using Docker-in-Docker, Docker downloads all layers of your image every
-time you create a build. Recent versions of Docker (Docker 1.13 and above) can
+time you create a build. Recent versions of Docker (Docker 1.13 and later) can
use a pre-existing image as a cache during the `docker build` step. This considerably
speeds up the build process.
@@ -737,9 +727,9 @@ as a cache source by using multiple `--cache-from` arguments. Any image that's u
with the `--cache-from` argument must first be pulled
(using `docker pull`) before it can be used as a cache source.
-### Using Docker caching
+### Docker caching example
-Here's a `.gitlab-ci.yml` file showing how Docker caching can be used:
+Here's a `.gitlab-ci.yml` file that shows how to use Docker caching:
```yaml
image: docker:19.03.12
@@ -764,12 +754,12 @@ build:
- docker push $CI_REGISTRY_IMAGE:latest
```
-The steps in the `script` section for the `build` stage can be summed up to:
+In the `script` section for the `build` stage:
1. The first command tries to pull the image from the registry so that it can be
used as a cache for the `docker build` command.
-1. The second command builds a Docker image using the pulled image as a
- cache (notice the `--cache-from $CI_REGISTRY_IMAGE:latest` argument) if
+1. The second command builds a Docker image by using the pulled image as a
+ cache (see the `--cache-from $CI_REGISTRY_IMAGE:latest` argument) if
available, and tags it.
1. The last two commands push the tagged Docker images to the container registry
so that they may also be used as cache for subsequent builds.
@@ -818,10 +808,10 @@ variables:
### Use the OverlayFS driver for every project
-If you use your own [GitLab Runners](https://docs.gitlab.com/runner/), you
+If you use your own [runners](https://docs.gitlab.com/runner/), you
can enable the driver for every project by setting the `DOCKER_DRIVER`
environment variable in the
-[`[[runners]]` section of `config.toml`](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runners-section):
+[`[[runners]]` section of the `config.toml` file](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runners-section):
```toml
environment = ["DOCKER_DRIVER=overlay2"]
@@ -832,7 +822,7 @@ If you're running multiple runners, you have to modify all configuration files.
Read more about the [runner configuration](https://docs.gitlab.com/runner/configuration/)
and [using the OverlayFS storage driver](https://docs.docker.com/engine/userguide/storagedriver/overlayfs-driver/).
-## Using the GitLab Container Registry
+## Use the GitLab Container Registry
After you've built a Docker image, you can push it up to the built-in
[GitLab Container Registry](../../user/packages/container_registry/index.md#build-and-push-by-using-gitlab-cicd).
@@ -842,13 +832,12 @@ After you've built a Docker image, you can push it up to the built-in
### `docker: Cannot connect to the Docker daemon at tcp://docker:2375. Is the docker daemon running?`
This is a common error when you are using
-[Docker in Docker](#use-the-docker-executor-with-the-docker-image-docker-in-docker)
-v19.03 or higher.
+[Docker-in-Docker](#use-the-docker-executor-with-the-docker-image-docker-in-docker)
+v19.03 or later.
-This occurs because Docker starts on TLS automatically, so you need to do some setup.
-If:
+This issue occurs because Docker starts on TLS automatically.
-- This is the first time setting it up, carefully read
- [using Docker in Docker workflow](#use-the-docker-executor-with-the-docker-image-docker-in-docker).
-- You are upgrading from v18.09 or earlier, read our
+- If this is your first time setting it up, read
+ [use the Docker executor with the Docker image](#use-the-docker-executor-with-the-docker-image-docker-in-docker).
+- If you are upgrading from v18.09 or earlier, read our
[upgrade guide](https://about.gitlab.com/blog/2019/07/31/docker-in-docker-with-docker-19-dot-03/).
diff --git a/doc/ci/docker/using_docker_images.md b/doc/ci/docker/using_docker_images.md
index e8028a862c4..173701ef358 100644
--- a/doc/ci/docker/using_docker_images.md
+++ b/doc/ci/docker/using_docker_images.md
@@ -9,23 +9,22 @@ type: concepts, howto
You can run your CI/CD jobs in separate, isolated Docker containers.
-When you run a Docker container on your local machine, it acts as a reproducible build environment.
-You can run tests in the container, instead of testing on a dedicated CI/CD server.
+If you run Docker on your local machine, you can run tests in the container,
+rather than testing on a dedicated CI/CD server.
To run CI/CD jobs in a Docker container, you need to:
-- Register a runner that uses the Docker executor. Then all jobs run in a Docker container.
-- Specify an image in your `.gitlab-ci.yml` file. The runner creates a container from this image
- and runs the jobs in it.
-- Optional. Specify other images in your `.gitlab-ci.yml` file. These containers are known as
- ["services"](#what-is-a-service) and you can use them to run services like MySQL separately.
+1. Register a runner so that all jobs run in Docker containers. Do this by choosing the Docker executor during registration.
+1. Specify which container to run the jobs in. Do this by specifying an image in your `.gitlab-ci.yml` file.
+1. Optional. Run other services, like MySQL, in containers. Do this by specifying [services](../services/index.md)
+ in your `.gitlab-ci.yml` file.
## Register a runner that uses the Docker executor
To use GitLab Runner with Docker you need to [register a runner](https://docs.gitlab.com/runner/register/)
that uses the Docker executor.
-In this example, we first set up a temporary template to supply the services:
+This example shows how to set up a temporary template to supply services:
```shell
cat > /tmp/test-config.template.toml << EOF
@@ -57,150 +56,20 @@ accessible during the build process.
## What is an image
The `image` keyword is the name of the Docker image the Docker executor
-runs to perform the CI tasks.
+uses to run CI/CD jobs.
-By default, the executor pulls images only from [Docker Hub](https://hub.docker.com/).
-However, you can configure the location in the `gitlab-runner/config.toml` file. For example,
-you can set the [Docker pull policy](https://docs.gitlab.com/runner/executors/docker.html#how-pull-policies-work)
+By default, the executor pulls images from [Docker Hub](https://hub.docker.com/).
+However, you can configure the registry location in the `gitlab-runner/config.toml` file.
+For example, you can set the [Docker pull policy](https://docs.gitlab.com/runner/executors/docker.html#how-pull-policies-work)
to use local images.
-For more information about images and Docker Hub, read
+For more information about images and Docker Hub, see
the [Docker Fundamentals](https://docs.docker.com/engine/understanding-docker/) documentation.
-## What is a service
-
-The `services` keyword defines another Docker image that's run during
-your job. It's linked to the Docker image that the `image` keyword defines,
-which allows you to access the service image during build time.
-
-The service image can run any application, but the most common use case is to
-run a database container, for example, `mysql`. It's easier and faster to use an
-existing image and run it as an additional container than to install `mysql` every
-time the project is built.
-
-You're not limited to only database services. You can add as many
-services you need to `.gitlab-ci.yml` or manually modify `config.toml`.
-Any image found at [Docker Hub](https://hub.docker.com/) or your private Container Registry can be
-used as a service.
-
-Services inherit the same DNS servers, search domains, and additional hosts as
-the CI container itself.
-
-You can see some widely used services examples in the relevant documentation of
-[CI services examples](../services/index.md).
-
-### How services are linked to the job
-
-To better understand how container linking works, read
-[Linking containers together](https://docs.docker.com/engine/userguide/networking/default_network/dockerlinks/).
-
-If you add `mysql` as service to your application, the image is
-used to create a container that's linked to the job container.
-
-The service container for MySQL is accessible under the hostname `mysql`.
-To access your database service, connect to the host named `mysql` instead of a
-socket or `localhost`. Read more in [accessing the services](#accessing-the-services).
-
-### How the health check of services works
-
-Services are designed to provide additional features which are **network accessible**.
-They may be a database like MySQL, or Redis, and even `docker:stable-dind` which
-allows you to use Docker-in-Docker. It can be practically anything that's
-required for the CI/CD job to proceed, and is accessed by network.
-
-To make sure this works, the runner:
-
-1. Checks which ports are exposed from the container by default.
-1. Starts a special container that waits for these ports to be accessible.
-
-If the second stage of the check fails, it prints the warning: `*** WARNING: Service XYZ probably didn't start properly`.
-This issue can occur because:
-
-- There is no opened port in the service.
-- The service was not started properly before the timeout, and the port is not
- responding.
-
-In most cases it affects the job, but there may be situations when the job
-still succeeds even if that warning was printed. For example:
-
-- The service was started shortly after the warning was raised, and the job is
- not using the linked service from the beginning. In that case, when the
- job needed to access the service, it may have been already there waiting for
- connections.
-- The service container is not providing any networking service, but it's doing
- something with the job's directory (all services have the job directory mounted
- as a volume under `/builds`). In that case, the service does its job, and
- because the job is not trying to connect to it, it does not fail.
-
-### What services are not for
-
-As mentioned before, this feature is designed to provide **network accessible**
-services. A database is the simplest example of such a service.
-
-The services feature is not designed to, and does not, add any software from the
-defined `services` image(s) to the job's container.
-
-For example, if you have the following `services` defined in your job, the `php`,
-`node` or `go` commands are **not** available for your script, and the job fails:
-
-```yaml
-job:
- services:
- - php:7
- - node:latest
- - golang:1.10
- image: alpine:3.7
- script:
- - php -v
- - node -v
- - go version
-```
-
-If you need to have `php`, `node` and `go` available for your script, you should
-either:
-
-- Choose an existing Docker image that contains all required tools.
-- Create your own Docker image, with all the required tools included,
- and use that in your job.
-
-### Accessing the services
-
-Let's say that you need a Wordpress instance to test some API integration with
-your application. You can then use for example the
-[`tutum/wordpress`](https://hub.docker.com/r/tutum/wordpress/) image in your
-`.gitlab-ci.yml` file:
-
-```yaml
-services:
- - tutum/wordpress:latest
-```
-
-If you don't [specify a service alias](#available-settings-for-services),
-when the job runs, `tutum/wordpress` is started. You have
-access to it from your build container under two hostnames:
-
-- `tutum-wordpress`
-- `tutum__wordpress`
-
-Hostnames with underscores are not RFC valid and may cause problems in third-party
-applications.
-
-The default aliases for the service's hostname are created from its image name
-following these rules:
-
-- Everything after the colon (`:`) is stripped.
-- Slash (`/`) is replaced with double underscores (`__`) and the primary alias
- is created.
-- Slash (`/`) is replaced with a single dash (`-`) and the secondary alias is
- created (requires GitLab Runner v1.1.0 or higher).
-
-To override the default behavior, you can
-[specify a service alias](#available-settings-for-services).
-
-## Define `image` and `services` from `.gitlab-ci.yml`
+## Define `image` in the `.gitlab-ci.yml` file
You can define an image that's used for all jobs, and a list of
-services that you want to use during build time:
+services that you want to use during runtime:
```yaml
default:
@@ -223,232 +92,61 @@ The image name must be in one of the following formats:
- `image: <image-name>:<tag>`
- `image: <image-name>@<digest>`
-It's also possible to define different images and services per job:
-
-```yaml
-default:
- before_script:
- - bundle install
-
-test:2.6:
- image: ruby:2.6
- services:
- - postgres:11.7
- script:
- - bundle exec rake spec
-
-test:2.7:
- image: ruby:2.7
- services:
- - postgres:12.2
- script:
- - bundle exec rake spec
-```
-
-Or you can pass some [extended configuration options](#extended-docker-configuration-options)
-for `image` and `services`:
-
-```yaml
-default:
- image:
- name: ruby:2.6
- entrypoint: ["/bin/bash"]
-
- services:
- - name: my-postgres:11.7
- alias: db-postgres
- entrypoint: ["/usr/local/bin/db-postgres"]
- command: ["start"]
-
- before_script:
- - bundle install
-
-test:
- script:
- - bundle exec rake spec
-```
-
-## Passing CI/CD variables to services
-
-You can also pass custom CI/CD [variables](../variables/README.md)
-to fine tune your Docker `images` and `services` directly in the `.gitlab-ci.yml` file.
-For more information, read about [`.gitlab-ci.yml` defined variables](../variables/README.md#gitlab-ciyml-defined-variables).
-
-```yaml
-# The following variables are automatically passed down to the Postgres container
-# as well as the Ruby container and available within each.
-variables:
- HTTPS_PROXY: "https://10.1.1.1:8090"
- HTTP_PROXY: "https://10.1.1.1:8090"
- POSTGRES_DB: "my_custom_db"
- POSTGRES_USER: "postgres"
- POSTGRES_PASSWORD: "example"
- PGDATA: "/var/lib/postgresql/data"
- POSTGRES_INITDB_ARGS: "--encoding=UTF8 --data-checksums"
-
-services:
- - name: postgres:11.7
- alias: db
- entrypoint: ["docker-entrypoint.sh"]
- command: ["postgres"]
-
-image:
- name: ruby:2.6
- entrypoint: ["/bin/bash"]
-
-before_script:
- - bundle install
-
-test:
- script:
- - bundle exec rake spec
-```
-
## Extended Docker configuration options
> Introduced in GitLab and GitLab Runner 9.4.
-When configuring the `image` or `services` entries, you can use a string or a map as
-options:
+You can use a string or a map for the `image` or `services` entries:
-- When using a string as an option, it must be the full name of the image to use
- (including the Registry part if you want to download the image from a Registry
+- Strings must include the full image name
+ (including the registry, if you want to download the image from a registry
other than Docker Hub).
-- When using a map as an option, then it must contain at least the `name`
- option, which is the same name of the image as used for the string setting.
+- Maps must contain at least the `name` option,
+ which is the same image name as used for the string setting.
For example, the following two definitions are equal:
-1. Using a string as an option to `image` and `services`:
+- A string for `image` and `services`:
- ```yaml
- image: "registry.example.com/my/image:latest"
-
- services:
- - postgresql:9.4
- - redis:latest
- ```
-
-1. Using a map as an option to `image` and `services`. The use of `image:name` is
- required:
-
- ```yaml
- image:
- name: "registry.example.com/my/image:latest"
-
- services:
- - name: postgresql:9.4
- - name: redis:latest
- ```
-
-### Available settings for `image`
-
-> Introduced in GitLab and GitLab Runner 9.4.
-
-| Setting | Required | GitLab version | Description |
-|------------|----------|----------------| ----------- |
-| `name` | yes, when used with any other option | 9.4 |Full name of the image to use. It should contain the Registry part if needed. |
-| `entrypoint` | no | 9.4 |Command or script to execute as the container's entrypoint. It's translated to Docker's `--entrypoint` option while creating the container. The syntax is similar to [`Dockerfile`'s `ENTRYPOINT`](https://docs.docker.com/engine/reference/builder/#entrypoint) directive, where each shell token is a separate string in the array. |
-
-### Available settings for `services`
-
-> Introduced in GitLab and GitLab Runner 9.4.
-
-| Setting | Required | GitLab version | Description |
-|------------|----------|----------------| ----------- |
-| `name` | yes, when used with any other option | 9.4 | Full name of the image to use. It should contain the Registry part if needed. |
-| `entrypoint` | no | 9.4 |Command or script to execute as the container's entrypoint. It's translated to Docker's `--entrypoint` option while creating the container. The syntax is similar to [`Dockerfile`'s `ENTRYPOINT`](https://docs.docker.com/engine/reference/builder/#entrypoint) directive, where each shell token is a separate string in the array. |
-| `command` | no | 9.4 |Command or script that should be used as the container's command. It's translated to arguments passed to Docker after the image's name. The syntax is similar to [`Dockerfile`'s `CMD`](https://docs.docker.com/engine/reference/builder/#cmd) directive, where each shell token is a separate string in the array. |
-| `alias` (1) | no | 9.4 |Additional alias that can be used to access the service from the job's container. Read [Accessing the services](#accessing-the-services) for more information. |
-
-(1) Alias support for the Kubernetes executor was [introduced](https://gitlab.com/gitlab-org/gitlab-runner/-/issues/2229) in GitLab Runner 12.8, and is only available for Kubernetes version 1.7 or later.
-
-### Starting multiple services from the same image
-
-> Introduced in GitLab and GitLab Runner 9.4. Read more about the [extended configuration options](#extended-docker-configuration-options).
-
-Before the new extended Docker configuration options, the following configuration
-would not work properly:
-
-```yaml
-services:
- - mysql:latest
- - mysql:latest
-```
-
-The runner would start two containers, each that uses the `mysql:latest` image.
-However, both of them would be added to the job's container with the `mysql` alias, based on
-the [default hostname naming](#accessing-the-services). This would end with one
-of the services not being accessible.
-
-After the new extended Docker configuration options, the above example would
-look like:
-
-```yaml
-services:
- - name: mysql:latest
- alias: mysql-1
- - name: mysql:latest
- alias: mysql-2
-```
-
-The runner still starts two containers using the `mysql:latest` image,
-however now each of them are also accessible with the alias configured
-in `.gitlab-ci.yml` file.
-
-### Setting a command for the service
-
-> Introduced in GitLab and GitLab Runner 9.4. Read more about the [extended configuration options](#extended-docker-configuration-options).
-
-Let's assume you have a `super/sql:latest` image with some SQL database
-in it. You would like to use it as a service for your job. Let's also
-assume that this image does not start the database process while starting
-the container. The user needs to manually use `/usr/bin/super-sql run` as
-a command to start the database.
-
-Before the new extended Docker configuration options, you would need to:
-
-- Create your own image based on the `super/sql:latest` image.
-- Add the default command.
-- Use the image in the job's configuration:
-
- ```dockerfile
- # my-super-sql:latest image's Dockerfile
+ ```yaml
+ image: "registry.example.com/my/image:latest"
- FROM super/sql:latest
- CMD ["/usr/bin/super-sql", "run"]
+ services:
+ - postgresql:9.4
+ - redis:latest
```
+- A map for `image` and `services`. The `image:name` is
+ required:
+
```yaml
- # .gitlab-ci.yml
+ image:
+ name: "registry.example.com/my/image:latest"
services:
- - my-super-sql:latest
+ - name: postgresql:9.4
+ - name: redis:latest
```
-After the new extended Docker configuration options, you can
-set a `command` in the `.gitlab-ci.yml` file instead:
-
-```yaml
-# .gitlab-ci.yml
+### Available settings for `image`
-services:
- - name: super/sql:latest
- command: ["/usr/bin/super-sql", "run"]
-```
+> Introduced in GitLab and GitLab Runner 9.4.
-The syntax of `command` is similar to [Dockerfile's `CMD`](https://docs.docker.com/engine/reference/builder/#cmd).
+| Setting | Required | Description |
+|------------|----------| ----------- |
+| `name` | Yes, when used with any other option. | Full name of the image. It should contain the registry part if needed. |
+| `entrypoint` | No. | Command or script to execute as the container's entrypoint. It's translated to Docker's `--entrypoint` option while creating the container. The syntax is similar to [`Dockerfile`'s `ENTRYPOINT`](https://docs.docker.com/engine/reference/builder/#entrypoint) directive, where each shell token is a separate string in the array. |
### Overriding the entrypoint of an image
-> Introduced in GitLab and GitLab Runner 9.4. Read more about the [extended configuration options](#extended-docker-configuration-options).
+> Introduced in GitLab and GitLab Runner 9.4. Read more about the [extended configuration options](../docker/using_docker_images.md#extended-docker-configuration-options).
-Before showing the available entrypoint override methods, let's describe
+Before explaining the available entrypoint override methods, let's describe
how the runner starts. It uses a Docker image for the containers used in the
CI/CD jobs:
-1. The runner starts a Docker container using the defined entrypoint (default
- from `Dockerfile` that may be overridden in `.gitlab-ci.yml`)
+1. The runner starts a Docker container using the defined entrypoint. The default
+ from `Dockerfile` that may be overridden in the `.gitlab-ci.yml` file.
1. The runner attaches itself to a running container.
1. The runner prepares a script (the combination of
[`before_script`](../yaml/README.md#before_script),
@@ -457,14 +155,13 @@ CI/CD jobs:
1. The runner sends the script to the container's shell `stdin` and receives the
output.
-To override the entrypoint of a Docker image, you should
-define an empty `entrypoint` in `.gitlab-ci.yml`, so the runner does not start
-a useless shell layer. However, that does not work for all Docker versions, and
-you should check which one your runner is using:
+To override the entrypoint of a Docker image,
+define an empty `entrypoint` in the `.gitlab-ci.yml` file, so the runner does not start
+a useless shell layer. However, that does not work for all Docker versions.
-- _If Docker 17.06 or later is used,_ the `entrypoint` can be set to an empty value.
-- _If Docker 17.03 or previous versions are used,_ the `entrypoint` can be set to
- `/bin/sh -c`, `/bin/bash -c` or an equivalent shell available in the image.
+- For Docker 17.06 and later, the `entrypoint` can be set to an empty value.
+- For Docker 17.03 and earlier, the `entrypoint` can be set to
+ `/bin/sh -c`, `/bin/bash -c`, or an equivalent shell available in the image.
The syntax of `image:entrypoint` is similar to [Dockerfile's `ENTRYPOINT`](https://docs.docker.com/engine/reference/builder/#entrypoint).
@@ -484,7 +181,7 @@ With the extended Docker configuration options, instead of:
You can now define an `entrypoint` in the `.gitlab-ci.yml` file.
-**For Docker 17.06+:**
+**For Docker 17.06 and later:**
```yaml
image:
@@ -492,7 +189,7 @@ image:
entrypoint: [""]
```
-**For Docker =< 17.03:**
+**For Docker 17.03 and earlier:**
```yaml
image:
@@ -517,40 +214,38 @@ that runner.
To access private container registries, the GitLab Runner process can use:
-- [Statically defined credentials](#using-statically-defined-credentials). That is, a username and password for a specific registry.
-- [Credentials Store](#using-credentials-store). For more information, read [the relevant Docker documentation](https://docs.docker.com/engine/reference/commandline/login/#credentials-store).
-- [Credential Helpers](#using-credential-helpers). For more information, read [the relevant Docker documentation](https://docs.docker.com/engine/reference/commandline/login/#credential-helpers).
+- [Statically defined credentials](#use-statically-defined-credentials). That is, a username and password for a specific registry.
+- [Credentials Store](#use-a-credentials-store). For more information, see [the relevant Docker documentation](https://docs.docker.com/engine/reference/commandline/login/#credentials-store).
+- [Credential Helpers](#use-credential-helpers). For more information, see [the relevant Docker documentation](https://docs.docker.com/engine/reference/commandline/login/#credential-helpers).
-To define which should be used, the GitLab Runner process reads the configuration in the following order:
+To define which option should be used, the runner process reads the configuration in this order:
-- `DOCKER_AUTH_CONFIG` variable provided as either:
- - A [CI/CD variable](../variables/README.md) in `.gitlab-ci.yml`.
- - A project's variables stored on the projects **Settings > CI/CD** page.
-- `DOCKER_AUTH_CONFIG` variable provided as environment variable in `config.toml` of the runner.
-- `config.json` file placed in `$HOME/.docker` directory of the user running GitLab Runner process.
- If the `--user` flag is provided to run the GitLab Runner child processes as unprivileged user,
- the home directory of the main GitLab Runner process user is used.
+- A `DOCKER_AUTH_CONFIG` variable provided as either:
+ - A [CI/CD variable](../variables/README.md) in the `.gitlab-ci.yml` file.
+ - A project's variables stored on the project's **Settings > CI/CD** page.
+- A `DOCKER_AUTH_CONFIG` variable provided as environment variable in the runner's `config.toml` file.
+- A `config.json` file in `$HOME/.docker` directory of the user running the process.
+ If the `--user` flag is provided to run the child processes as unprivileged user,
+ the home directory of the main runner process user is used.
-GitLab Runner reads this configuration **only** from `config.toml` and ignores it if
-it's provided as an environment variable. This is because GitLab Runner uses **only**
-`config.toml` configuration and does not interpolate **any** environment variables at
+The runner reads this configuration **only** from the `config.toml` file and ignores it if
+it's provided as a CI/CD variable. This is because the runner uses **only**
+`config.toml` configuration and does not interpolate **any** CI/CD variables at
runtime.
### Requirements and limitations
-- This feature requires GitLab Runner **1.8** or higher.
-- For GitLab Runner versions **>= 0.6, <1.8** there was a partial
- support for using private registries, which required manual configuration
- of credentials on runner's host. We recommend to upgrade your runner to
- at least version **1.8** if you want to use private registries.
- Available for [Kubernetes executor](https://docs.gitlab.com/runner/executors/kubernetes.html)
in GitLab Runner 13.1 and later.
-- [Credentials Store](#using-credentials-store) and [Credential Helpers](#using-credential-helpers) require binaries to be added to the GitLab Runner's `$PATH`, and require access to do so. Therefore, these features are not available on shared runners, or any other runner where the user does not have access to the environment where the runner is installed.
+- [Credentials Store](#use-a-credentials-store) and [Credential Helpers](#use-credential-helpers)
+ require binaries to be added to the GitLab Runner `$PATH`, and require access to do so. Therefore,
+ these features are not available on shared runners, or any other runner where the user does not
+ have access to the environment where the runner is installed.
-### Using statically-defined credentials
+### Use statically-defined credentials
-There are two approaches that you can take in order to access a
-private registry. Both require setting the environment variable
+There are two approaches that you can take to access a
+private registry. Both require setting the CI/CD variable
`DOCKER_AUTH_CONFIG` with appropriate authentication information.
1. Per-job: To configure one job to access a private registry, add
@@ -561,7 +256,7 @@ private registry. Both require setting the environment variable
See below for examples of each.
-#### Determining your `DOCKER_AUTH_CONFIG` data
+#### Determine your `DOCKER_AUTH_CONFIG` data
As an example, let's assume you want to use the `registry.example.com:5000/private/image:latest`
image. This image is private and requires you to sign in to a private container
@@ -592,7 +287,7 @@ Use one of the following methods to determine the value of `DOCKER_AUTH_CONFIG`:
docker logout registry.example.com:5000
```
-- In some setups, it's possible that Docker client uses the available system key
+- In some setups, it's possible the Docker client uses the available system key
store to store the result of `docker login`. In that case, it's impossible to
read `~/.docker/config.json`, so you must prepare the required
base64-encoded version of `${username}:${password}` and create the Docker
@@ -618,7 +313,7 @@ Use one of the following methods to determine the value of `DOCKER_AUTH_CONFIG`:
}
```
-#### Configuring a job
+#### Configure a job
To configure a single job with access for `registry.example.com:5000`,
follow these steps:
@@ -637,7 +332,7 @@ follow these steps:
```
1. You can now use any private image from `registry.example.com:5000` defined in
- `image` and/or `services` in your `.gitlab-ci.yml` file:
+ `image` or `services` in your `.gitlab-ci.yml` file:
```yaml
image: registry.example.com:5000/namespace/image:tag
@@ -651,19 +346,19 @@ registries to the `"auths"` hash as described above.
The full `hostname:port` combination is required everywhere
for the runner to match the `DOCKER_AUTH_CONFIG`. For example, if
-`registry.example.com:5000/namespace/image:tag` is specified in `.gitlab-ci.yml`,
+`registry.example.com:5000/namespace/image:tag` is specified in the `.gitlab-ci.yml` file,
then the `DOCKER_AUTH_CONFIG` must also specify `registry.example.com:5000`.
Specifying only `registry.example.com` does not work.
### Configuring a runner
-If you have many pipelines that access the same registry, it is
-probably better to set up registry access at the runner level. This
+If you have many pipelines that access the same registry, you should
+set up registry access at the runner level. This
allows pipeline authors to have access to a private registry just by
-running a job on the appropriate runner. It also makes registry
-changes and credential rotations much simpler.
+running a job on the appropriate runner. It also helps simplify registry
+changes and credential rotations.
-Of course this means that any job on that runner can access the
+This means that any job on that runner can access the
registry with the same privilege, even across projects. If you need to
control access to the registry, you need to be sure to control
access to the runner.
@@ -686,14 +381,12 @@ To add `DOCKER_AUTH_CONFIG` to a runner:
1. Restart the runner service.
-### Using Credentials Store
-
-> Support for using Credentials Store was added in GitLab Runner 9.5.
+### Use a Credentials Store
-To configure credentials store, follow these steps:
+To configure a Credentials Store:
-1. To use a credentials store, you need an external helper program to interact with a specific keychain or external store.
- Make sure the helper program is available in GitLab Runner `$PATH`.
+1. To use a Credentials Store, you need an external helper program to interact with a specific keychain or external store.
+ Make sure the helper program is available in the GitLab Runner `$PATH`.
1. Make GitLab Runner use it. There are two ways to accomplish this. Either:
@@ -716,16 +409,16 @@ To configure credentials store, follow these steps:
If you use both images from a private registry and public images from Docker Hub,
pulling from Docker Hub fails. Docker daemon tries to use the same credentials for **all** the registries.
-### Using Credential Helpers
+### Use Credential Helpers
-> Support for using Credential Helpers was added in GitLab Runner 12.0
+> Introduced in GitLab Runner 12.0.
As an example, let's assume that you want to use the `aws_account_id.dkr.ecr.region.amazonaws.com/private/image:latest`
image. This image is private and requires you to log in into a private container registry.
To configure access for `aws_account_id.dkr.ecr.region.amazonaws.com`, follow these steps:
-1. Make sure `docker-credential-ecr-login` is available in GitLab Runner's `$PATH`.
+1. Make sure `docker-credential-ecr-login` is available in the GitLab Runner `$PATH`.
1. Have any of the following [AWS credentials setup](https://github.com/awslabs/amazon-ecr-credential-helper#aws-credentials).
Make sure that GitLab Runner can access the credentials.
1. Make GitLab Runner use it. There are two ways to accomplish this. Either:
@@ -742,9 +435,9 @@ To configure access for `aws_account_id.dkr.ecr.region.amazonaws.com`, follow th
}
```
- This configures Docker to use the credential helper for a specific registry.
+ This configures Docker to use the Credential Helper for a specific registry.
- or
+ Instead, you can configure Docker to use the Credential Helper for all Amazon Elastic Container Registry (ECR) registries:
```json
{
@@ -752,10 +445,8 @@ To configure access for `aws_account_id.dkr.ecr.region.amazonaws.com`, follow th
}
```
- This configures Docker to use the credential helper for all Amazon Elastic Container Registry (ECR) registries.
-
- Or, if you're running self-managed runners,
- add the above JSON to `${GITLAB_RUNNER_HOME}/.docker/config.json`.
+ add the previous JSON to `${GITLAB_RUNNER_HOME}/.docker/config.json`.
GitLab Runner reads this configuration file and uses the needed helper for this
specific repository.
@@ -766,101 +457,8 @@ To configure access for `aws_account_id.dkr.ecr.region.amazonaws.com`, follow th
image: aws_account_id.dkr.ecr.region.amazonaws.com/private/image:latest
```
- In the example above, GitLab Runner looks at `aws_account_id.dkr.ecr.region.amazonaws.com` for the
+ In the example, GitLab Runner looks at `aws_account_id.dkr.ecr.region.amazonaws.com` for the
image `private/image:latest`.
You can add configuration for as many registries as you want, adding more
-registries to the `"credHelpers"` hash as described above.
-
-## Configuring services
-
-Many services accept environment variables, which you can use to change
-database names or set account names, depending on the environment.
-
-GitLab Runner 0.5.0 and up passes all YAML-defined CI/CD variables to the created
-service containers.
-
-For all possible configuration variables, check the documentation of each image
-provided in their corresponding Docker hub page.
-
-All CI/CD variables are passed to all services containers. It's not
-designed to distinguish which variable should go where.
-
-### PostgreSQL service example
-
-Read the specific documentation for
-[using PostgreSQL as a service](../services/postgres.md).
-
-### MySQL service example
-
-Read the specific documentation for
-[using MySQL as a service](../services/mysql.md).
-
-## How Docker integration works
-
-Below is a high level overview of the steps performed by Docker during job
-time.
-
-1. Create any service container: `mysql`, `postgresql`, `mongodb`, `redis`.
-1. Create a cache container to store all volumes as defined in `config.toml` and
- `Dockerfile` of build image (`ruby:2.6` as in above example).
-1. Create a build container and link any service container to build container.
-1. Start the build container, and send a job script to the container.
-1. Run the job script.
-1. Checkout code in: `/builds/group-name/project-name/`.
-1. Run any step defined in `.gitlab-ci.yml`.
-1. Check the exit status of build script.
-1. Remove the build container and all created service containers.
-
-## How to debug a job locally
-
-The following commands are run without root privileges. You should be
-able to run Docker with your regular user account.
-
-First start with creating a file named `build_script`:
-
-```shell
-cat <<EOF > build_script
-git clone https://gitlab.com/gitlab-org/gitlab-runner.git /builds/gitlab-org/gitlab-runner
-cd /builds/gitlab-org/gitlab-runner
-make
-EOF
-```
-
-Here we use as an example the GitLab Runner repository which contains a
-Makefile, so running `make` executes the commands defined in the Makefile.
-Instead of `make`, you could run the command which is specific to your project.
-
-Then create some service containers:
-
-```shell
-docker run -d --name service-mysql mysql:latest
-docker run -d --name service-postgres postgres:latest
-```
-
-This creates two service containers, named `service-mysql` and
-`service-postgres` which use the latest MySQL and PostgreSQL images
-respectively. They both run in the background (`-d`).
-
-Finally, create a build container by executing the `build_script` file we
-created earlier:
-
-```shell
-docker run --name build -i --link=service-mysql:mysql --link=service-postgres:postgres ruby:2.6 /bin/bash < build_script
-```
-
-The above command creates a container named `build` that's spawned from
-the `ruby:2.6` image and has two services linked to it. The `build_script` is
-piped using `stdin` to the bash interpreter which in turn executes the
-`build_script` in the `build` container.
-
-When you finish testing and no longer need the containers, you can remove them
-with:
-
-```shell
-docker rm -f -v build service-mysql service-postgres
-```
-
-This forcefully (`-f`) removes the `build` container, the two service
-containers, and all volumes (`-v`) that were created with the container
-creation.
+registries to the `"credHelpers"` hash.