Docker and CI/CD · Junior · Question 34 of 75

Why shouldn't you copy a .env file with secrets into an image?

Explanation

Image layers are just tar archives; deleting a file in a later layer doesn't remove it from history. Pass secrets at runtime or with build secrets.

Further reading

Problem with a question

Docker and CI/CD · Junior · question 34

Test yourself

Take the Docker and CI/CD · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz