Skip to main content

Docker-in-Docker migration

info

As of 06/17/2025, we no longer support image build via Docker-in-Docker.

The following documentation explains how to migrate to the two solutions recommended by adista:

note

In the examples below, we use latest labels for illustration purposes. In your production environment, fixed labels are recommended.

Buildah

.gitlab-ci.yml
build-with-buildah:
stage: build
image: quay.io/buildah/stable:latest
before_script:
- echo "$CI_REGISTRY_PASSWORD" | buildah login --username "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
script:
- buildah build --tag $CI_REGISTRY_IMAGE:latest .
- buildah push $CI_REGISTRY_IMAGE:latest
after_script:
- buildah logout $CI_REGISTRY

For further information: https://docs.gitlab.com/ci/docker/using_docker_build/#buildah-example

Kaniko

warning

The Kaniko project was archived by Google on 06/03/2025. It is therefore recommended to stop using it or to use a maintained fork, such as chainguard-dev/kaniko.

The following elements are mandatory:

  • The debug label, because only this image contains a shell, which is required for use with the GitLab CI/CD.
  • The image entrypoint must be overloaded.
.gitlab-ci.yml
build-with-kaniko:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- /kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}:latest"
--cache=true
--cache-repo="${CI_REGISTRY_IMAGE}"

For further information: https://docs.gitlab.com/ci/docker/using_kaniko/