Interview Prep/Docker/Security and scanning

Stop leaking build-time secrets through `docker history` in an existing pipeline.

IntermediateScenarioSecurity and scanning
Answer

Situation read → Old Dockerfiles use ARG TOKEN and RUN git clone https://$TOKEN@....

What I'd do → Replace with RUN --mount=type=secret,id=gh_token ... or --mount=type=ssh; rotate leaked tokens; purge old tags; add a Trivy secret scan to CI.

Why → ARG values are stored in image metadata and visible in history.

Interview tip → Rotate first.

All Docker questions Roadmap: Docker & containers

More on Security and scanning