remove files from inside the container after build. Do you have a way?



  • How to delete files after build? I’m “building” an image with a Google cloud key, so I can’t leave this key inside the container for security reasons. The problem is that if I don't for her, google cloud won't authenticate. Or is there another way I authenticate the Google cloud key out of the container?



  • https://docs.docker.com/engine/userguide/eng-image/multistage-build/ is a docker feature designed exactly for this scenario, however it does something slightly different. Instead of removing files, you only copy for the last stage the binary files, leaving all the other files in the previous stages. The resulting image contains only the last stage, all predecessors only exist during the build.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2