Dear KodeKloud,
there is question in Mock exam 2 , which is Question :- Which of the below can help minimize the image size?
the below option is marked wrong,
Avoid sending unwanted files to the build context using .dockerignore
How is this conclusion, for sure .dockeignore can help in reducing the image size, please check
A google search got me this infos
To conclude, using your .dockerignore as a whitelist allows to:
Exclude by default everything from the build context
Reduce the size of the tar archive sent to the Docker daemon
Reduce the risk of packaging unwanted or sensitive files in your Docker image
Reduce the effort to keep exclusion patterns up to date
Further checking on the net I found the following, adding it for reference
Can we get advice on what is the correct answer
Docker Image Size - How to Keep It Small?
Use a Smaller Image Base (Alpine) Use a .dockerignore File.
Utilize the Multi-Stage Builds Feature in Docker.
Avoid Adding Unnecessary Layers to Reduce Docker Image Size.
Beware of Updates and Unnecessary Packages and Dependencies.
Bonus Tip: Caching.