diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 17:34:42 +0300 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /doc/ci/docker | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'doc/ci/docker')
-rw-r--r-- | doc/ci/docker/using_docker_build.md | 2 | ||||
-rw-r--r-- | doc/ci/docker/using_docker_images.md | 36 | ||||
-rw-r--r-- | doc/ci/docker/using_kaniko.md | 13 |
3 files changed, 41 insertions, 10 deletions
diff --git a/doc/ci/docker/using_docker_build.md b/doc/ci/docker/using_docker_build.md index 427f61deb29..f992af6c8a5 100644 --- a/doc/ci/docker/using_docker_build.md +++ b/doc/ci/docker/using_docker_build.md @@ -476,7 +476,7 @@ which can be avoided if a different driver is used, for example `overlay2`. On Ubuntu systems, this is done by editing `/etc/modules`. Just add the following line into it: - ```text + ```plaintext overlay ``` diff --git a/doc/ci/docker/using_docker_images.md b/doc/ci/docker/using_docker_images.md index 90e5c77063e..51139da2d16 100644 --- a/doc/ci/docker/using_docker_images.md +++ b/doc/ci/docker/using_docker_images.md @@ -26,7 +26,20 @@ test them on a dedicated CI server. To use GitLab Runner with Docker you need to [register a new Runner](https://docs.gitlab.com/runner/register/) to use the `docker` executor. -A one-line example can be seen below: +An example can be seen below. First we set up a temporary template to supply the services: + +```shell +cat > /tmp/test-config.template.toml << EOF +[[runners]] +[runners.docker] +[[runners.docker.services]] +name = "postgres:latest" +[[runners.docker.services]] +name = "mysql:latest" +EOF +``` + +Then we register the runner using the template that was just created: ```shell sudo gitlab-runner register \ @@ -34,9 +47,8 @@ sudo gitlab-runner register \ --registration-token "PROJECT_REGISTRATION_TOKEN" \ --description "docker-ruby:2.6" \ --executor "docker" \ - --docker-image ruby:2.6 \ - --docker-services postgres:latest \ - --docker-services mysql:latest + --template-config /tmp/test-config.template.toml \ + --docker-image ruby:2.6 ``` The registered runner will use the `ruby:2.6` Docker image and will run two @@ -197,7 +209,7 @@ default: image: ruby:2.6 services: - - postgres:9.3 + - postgres:11.7 before_script: - bundle install @@ -207,6 +219,12 @@ test: - bundle exec rake spec ``` +The image name must be in one of the following formats: + +- `image: <image-name>` (Same as using `<image-name>` with the `latest` tag) +- `image: <image-name>:<tag>` +- `image: <image-name>@<digest>` + It is also possible to define different images and services per job: ```yaml @@ -217,14 +235,14 @@ default: test:2.6: image: ruby:2.6 services: - - postgres:9.3 + - postgres:11.7 script: - bundle exec rake spec test:2.7: image: ruby:2.7 services: - - postgres:9.4 + - postgres:12.2 script: - bundle exec rake spec ``` @@ -239,7 +257,7 @@ default: entrypoint: ["/bin/bash"] services: - - name: my-postgres:9.4 + - name: my-postgres:11.7 alias: db-postgres entrypoint: ["/usr/local/bin/db-postgres"] command: ["start"] @@ -271,7 +289,7 @@ variables: POSTGRES_INITDB_ARGS: "--encoding=UTF8 --data-checksums" services: -- name: postgres:9.4 +- name: postgres:11.7 alias: db entrypoint: ["docker-entrypoint.sh"] command: ["postgres"] diff --git a/doc/ci/docker/using_kaniko.md b/doc/ci/docker/using_kaniko.md index 5a6f7490266..587f1f91f72 100644 --- a/doc/ci/docker/using_kaniko.md +++ b/doc/ci/docker/using_kaniko.md @@ -82,6 +82,7 @@ store: ```yaml before_script: + - mkdir -p /kaniko/.docker - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - | echo "-----BEGIN CERTIFICATE----- @@ -89,6 +90,18 @@ store: -----END CERTIFICATE-----" >> /kaniko/ssl/certs/ca-certificates.crt ``` +## Video walkthrough of a working example + +The [Least Privilege Container Builds with Kaniko on GitLab](https://www.youtube.com/watch?v=d96ybcELpFs) +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](../../user/gitlab_com/index.md#shared-runners) +- [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 +on what other GitLab CI patterns are demonstrated are available at the project page. + <!-- ## Troubleshooting Include any troubleshooting steps that you can foresee. If you know beforehand what issues |