Skip to content
Snippets Groups Projects
README.md 26.98 KiB

GitLab CI template for Docker

This project implements a generic GitLab CI template Docker based projects.

Usage

In order to include this template in your project, add the following to your .gitlab-ci.yml :

include:
  - project: 'to-be-continuous/docker'
    ref: '3.0.0'
    file: '/templates/gitlab-ci-docker.yml'

Understanding the Docker template

The template supports two ways of building your Docker images:

  1. The former Docker-in-Docker technique, that was widely used for years because of no other alternative, but that is now commonly recognized to have significant security issues (read this post for more info),
  2. Or using kaniko, an open-source tool from Google for building Docker images, and that solves Docker-in-Docker security issues (and also speeds-up build times).

By default, the template uses the kaniko way, but you may activate the Docker-in-Docker build at your own risks by setting DOCKER_DIND_BUILD to true (see below). ⚠️ In that case, make sure your runner has required privileges to run Docker-in-Docker (see GitLab doc).

Global variables