Secrets in the Image History
A Dockerfile does COPY .npmrc /root/.npmrc, runs npm ci, then RUN rm /root/.npmrc. Is the token safe in the published image?
COPY .npmrc /root/.npmrc
npm ci
RUN rm /root/.npmrc
Choose one answer
No: it remains in the COPY layer, readable by anyone with the image.
COPY
Yes: the file is deleted before the image is finished.
No, but only if the image is run with --privileged.
--privileged
Yes, as long as the image is only pushed to a private registry with access control.