I have a Dockerfile in my git project and when creating a container, I want to insert a secret into that dockerfile. (A database password as an environment variable) like this:
ENV MY_DB_PASSWORD “{MySecret}”
other than using sed, is there a cleaner solution (or plugin) that supports this?
Never inject secrets directly into an image ( that is what a dockerfile creates).
Pass it when running
a container ( e.g. via environment vars: docker run -e MY_DB_PASSWORD=xxxxxx <image> <cmd>
)
You can have an enviroment hint in the docker file: ENV MY_DB_PASSWORD