How do you build Docker images in GitLab CI without privileged mode?

AdvancedConceptGitLab CI
Answer

Docker-in-Docker (docker:dind service) needs a privileged runner, which gives the job near-root on the host. Rootless alternatives that need no daemon: Kaniko (archived by Google in 2025, forks exist), Buildah (buildah bud rootless), or BuildKit rootless. Another approach is mounting a remote BuildKit builder or using a dedicated, isolated build runner.

build:
  image: quay.io/buildah/stable
  script:
    - buildah bud -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA .
    - buildah push --creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
All CI/CD questions Roadmap: GitLab CI/CD

More on GitLab CI