remove files from the container after build. Can I do this?

Asked

Viewed 385 times

1

How to delete files after build? I am "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 get it, the google cloud won’t authenticate. Or is there another way I can authenticate the google cloud key from outside the container?

1 answer

1

Multi-stage builds is a Docker Feature designed exactly for this scenario, however it does something slightly different. Instead of removing files, you just copy the binary files to the last stage, leaving all the other files in the previous stages. The resulting image contains only the last stage, all predecessors only exist during build.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.