diff options
Diffstat (limited to 'doc/ci/docker')
-rw-r--r-- | doc/ci/docker/README.md | 9 | ||||
-rw-r--r-- | doc/ci/docker/index.md | 4 | ||||
-rw-r--r-- | doc/ci/docker/using_docker_build.md | 45 | ||||
-rw-r--r-- | doc/ci/docker/using_docker_images.md | 16 | ||||
-rw-r--r-- | doc/ci/docker/using_kaniko.md | 6 |
5 files changed, 49 insertions, 31 deletions
diff --git a/doc/ci/docker/README.md b/doc/ci/docker/README.md deleted file mode 100644 index 577a80407d7..00000000000 --- a/doc/ci/docker/README.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -redirect_to: 'index.md' -remove_date: '2021-05-01' ---- - -This document was moved to [another location](index.md). - -<!-- This redirect file can be deleted after 2021-05-01. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page --> diff --git a/doc/ci/docker/index.md b/doc/ci/docker/index.md index 20599c5ca85..4f6da72af12 100644 --- a/doc/ci/docker/index.md +++ b/doc/ci/docker/index.md @@ -6,9 +6,9 @@ comments: false type: index --- -# Docker integration +# Docker integration **(FREE)** -There are two primary ways to incorporate [Docker](https://www.docker.com) in your CI/CD workflow. +There are two primary ways to incorporate [Docker](https://www.docker.com) into your CI/CD workflow: - **[Run your CI/CD jobs](using_docker_images.md) in Docker containers.** diff --git a/doc/ci/docker/using_docker_build.md b/doc/ci/docker/using_docker_build.md index 9dac08324c8..c56bc9a4dc8 100644 --- a/doc/ci/docker/using_docker_build.md +++ b/doc/ci/docker/using_docker_build.md @@ -5,7 +5,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w type: concepts, howto --- -# Use Docker to build Docker images +# Use Docker to build Docker images **(FREE)** You can use GitLab CI/CD with Docker to create Docker images. For example, you can create a Docker image of your application, @@ -25,8 +25,8 @@ To enable Docker commands for your CI/CD jobs, you can use: If you don't want to execute a runner in privileged mode, but want to use `docker build`, you can also [use kaniko](using_kaniko.md). -If you are using shared runners on GitLab.com, -[learn more about how these runners are configured](../runners/README.md). +If you are using shared runners on GitLab.com, +[learn more about how these runners are configured](../runners/index.md). ### Use the shell executor @@ -90,7 +90,7 @@ The Docker image has all of the `docker` tools installed and can run the job script in context of the image in privileged mode. We recommend you use [Docker-in-Docker with TLS enabled](#docker-in-docker-with-tls-enabled), -which is supported by [GitLab.com shared runners](../runners/README.md). +which is supported by [GitLab.com shared runners](../runners/index.md). 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. @@ -577,7 +577,7 @@ 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/index.md#before_script), run `docker login`: ```yaml @@ -682,10 +682,10 @@ There are multiple ways to define this authentication: - 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). +- In [`before_script`](../yaml/index.md#before_script). +- In [`script`](../yaml/index.md#script). -The following example shows [`before_script`](../yaml/README.md#before_script). +The following example shows [`before_script`](../yaml/index.md#before_script). The same commands apply for any solution you implement. ```yaml @@ -798,7 +798,7 @@ which can be avoided if a different driver is used, for example `overlay2`. ### Use the OverlayFS driver per project You can enable the driver for each project individually by using the `DOCKER_DRIVER` -[CI/CD variable](../yaml/README.md#variables) in `.gitlab-ci.yml`: +[CI/CD variable](../yaml/index.md#variables) in `.gitlab-ci.yml`: ```yaml variables: @@ -840,3 +840,30 @@ This issue occurs because Docker starts on TLS automatically. [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/). + +### Docker `no such host` error + +You may get an error that says +`docker: error during connect: Post https://docker:2376/v1.40/containers/create: dial tcp: lookup docker on x.x.x.x:53: no such host`. + +This issue can occur when the service's image name +[includes a registry hostname](../../ci/services/index.md#available-settings-for-services). For example: + +```yaml +image: docker:19.03.12 + +services: + - registry.hub.docker.com/library/docker:19.03.12-dind +``` + +A service's hostname is [derived from the full image name](../../ci/services/index.md#accessing-the-services). +However, the shorter service hostname `docker` is expected. +To allow service resolution and access, add an explicit alias for the service name `docker`: + +```yaml +image: docker:19.03.12 + +services: + - name: registry.hub.docker.com/library/docker:19.03.12-dind + alias: docker +``` diff --git a/doc/ci/docker/using_docker_images.md b/doc/ci/docker/using_docker_images.md index 29f4053f720..c2991ce66f9 100644 --- a/doc/ci/docker/using_docker_images.md +++ b/doc/ci/docker/using_docker_images.md @@ -5,7 +5,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w type: concepts, howto --- -# Run your CI/CD jobs in Docker containers +# Run your CI/CD jobs in Docker containers **(FREE)** You can run your CI/CD jobs in separate, isolated Docker containers. @@ -153,9 +153,9 @@ CI/CD jobs: 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), - [`script`](../yaml/README.md#script), - and [`after_script`](../yaml/README.md#after_script)). + [`before_script`](../yaml/index.md#before_script), + [`script`](../yaml/index.md#script), + and [`after_script`](../yaml/index.md#after_script)). 1. The runner sends the script to the container's shell `stdin` and receives the output. @@ -225,7 +225,7 @@ To access private container registries, the GitLab Runner process can use: To define which option should be used, the runner process reads the configuration in this order: - A `DOCKER_AUTH_CONFIG` variable provided as either: - - A [CI/CD variable](../variables/README.md) in the `.gitlab-ci.yml` file. + - A [CI/CD variable](../variables/index.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. @@ -322,7 +322,7 @@ Use one of the following methods to determine the value of `DOCKER_AUTH_CONFIG`: To configure a single job with access for `registry.example.com:5000`, follow these steps: -1. Create a [CI/CD variable](../variables/README.md) `DOCKER_AUTH_CONFIG` with the content of the +1. Create a [CI/CD variable](../variables/index.md) `DOCKER_AUTH_CONFIG` with the content of the Docker configuration file as the value: ```json @@ -395,7 +395,7 @@ To configure a Credentials Store: 1. Make GitLab Runner use it. There are two ways to accomplish this. Either: - Create a - [CI/CD variable](../variables/README.md) + [CI/CD variable](../variables/index.md) `DOCKER_AUTH_CONFIG` with the content of the Docker configuration file as the value: @@ -427,7 +427,7 @@ To configure access for `aws_account_id.dkr.ecr.region.amazonaws.com`, follow th Make sure that GitLab Runner can access the credentials. 1. Make GitLab Runner use it. There are two ways to accomplish this. Either: - - Create a [CI/CD variable](../variables/README.md) + - Create a [CI/CD variable](../variables/index.md) `DOCKER_AUTH_CONFIG` with the content of the Docker configuration file as the value: diff --git a/doc/ci/docker/using_kaniko.md b/doc/ci/docker/using_kaniko.md index 05769cc8f75..108d4e0dcad 100644 --- a/doc/ci/docker/using_kaniko.md +++ b/doc/ci/docker/using_kaniko.md @@ -5,7 +5,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w type: howto --- -# Use kaniko to build Docker images +# Use kaniko to build Docker images **(FREE)** > [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/45512) in GitLab 11.2. Requires GitLab Runner 11.2 and above. @@ -49,7 +49,7 @@ In the following example, kaniko is used to: The job runs only when a tag is pushed. A `config.json` file is created under `/kaniko/.docker` with the needed GitLab Container Registry credentials taken from the -[predefined CI/CD variables](../variables/README.md#predefined-cicd-variables) +[predefined CI/CD variables](../variables/index.md#predefined-cicd-variables) GitLab CI/CD provides. In the last step, kaniko uses the `Dockerfile` under the @@ -133,7 +133,7 @@ The [Least Privilege Container Builds with Kaniko on GitLab](https://www.youtube video is a walkthrough of the [Kaniko Docker Build](https://gitlab.com/guided-explorations/containers/kaniko-docker-build) Guided Exploration project pipeline. It was tested on: -- [GitLab.com shared runners](../runners/README.md) +- [GitLab.com shared runners](../runners/index.md) - [The Kubernetes runner executor](https://docs.gitlab.com/runner/executors/kubernetes.html) The example can be copied to your own group or instance for testing. More details |