feat(Dind): Test dind containers

This commit is contained in:
Marcel Feix 2022-06-14 18:35:09 +02:00
parent 5acce39a09
commit a34f3ba24d
No known key found for this signature in database
GPG Key ID: 04D016E104A25F03
3 changed files with 38 additions and 14 deletions

View File

@ -0,0 +1,12 @@
:sourcedir: ../../../../templates/
= Docker in Docker
This template helps to start jobs, that need a docker environment to run.
Simply expand from this Template.
.container scan template
[source,yaml]
----
include::{sourcedir}container/docker-in-docker.gitlab-ci.yml[]
----

View File

@ -0,0 +1,22 @@
.docker-in-docker:
services:
- name: docker:20.10.17-dind
command:
- "--registry-mirror"
- "https://nexus.corp.exxcellent.de:18000"
- "--insecure-registry"
- "nexus.corp.exxcellent.de:18000"
- "--insecure-registry"
- "gitlab.exxcellent.de:4567"
# explicitly disable tls to avoid docker startup interruption
- "--tls=false"
alias: docker
variables:
# Instruct Testcontainers to use the daemon of DinD.
DOCKER_HOST: "tcp://docker:2375"
# Instruct Docker not to start over TLS.
DOCKER_TLS_CERTDIR: ""
# Improve performance with overlayfs.
DOCKER_DRIVER: overlay2
# Needed by testcontainers https://www.testcontainers.org/supported_docker_environment/continuous_integration/gitlab_ci/
TESTCONTAINERS_HOST_OVERRIDE: "host.docker.internal"

View File

@ -1,22 +1,12 @@
include:
local: "templates/container/docker-in-docker.gitlab-ci.yml"
stages:
- verify
services:
- name: docker:dind
# explicitly disable tls to avoid docker startup interruption
command: [ "--tls=false" ]
alias: docker
variables:
# Instruct Testcontainers to use the daemon of DinD.
DOCKER_HOST: "tcp://docker:2375"
# Instruct Docker not to start over TLS.
DOCKER_TLS_CERTDIR: ""
# Improve performance with overlayfs.
DOCKER_DRIVER: overlay2
Test-Simple-Dind:
image: docker:stable
extends: .docker-in-docker
stage: verify
script:
- docker run -t alpine echo test