Interview Prep/CI/CD/Jenkins in Production

What are the pitfalls of Docker socket mounting in Jenkins agents, and what are alternatives?

AdvancedProductionJenkins in Production
Answer

Mounting /var/run/docker.sock gives any job root-equivalent control of the host, since it can start privileged containers and read other builds' data. Alternatives: rootless builders (Buildah, BuildKit rootless, Kaniko forks) in pod containers, a remote BuildKit service shared across jobs, or Docker-in-Docker on isolated, short-lived nodes dedicated to image builds. Separate image-build nodes from deploy nodes and never run untrusted PR builds on a node that can reach production.

All CI/CD questions

More on Jenkins in Production