Skip to content

Security

How do I pass secrets into a Docker build?

Quick answer

Use BuildKit build secrets with --secret, never ARG or ENV.

The detail that matters

ARG values persist in the image history and are trivially recoverable. Build secrets are mounted only for the RUN that uses them.

Your next build could be twice as fast, at half the price

Start free. Migrating away is the same one line, and we publish that diff too.