Google Professional Cloud Developer Question 251
Select 3Google Cloud PlatformYou are tasked with creating a secure container image for a web application hosted on Google Kubernetes Engine (GKE). Which practices should you follow to ensure the container image is secure?
- A
Use a minimal base image to reduce the attack surface.
- B
Include hardcoded credentials in the container image for application authentication.
- C
Regularly scan the container image for vulnerabilities using tools like Container Analysis.
- D
Run the application in the container as a non-root user.
- E
Install unnecessary packages in the container to provide flexibility for future updates.
Show answer and explanation
Correct answers: A, C, D
Explanation
Creating secure container images involves following best practices such as using minimal base images, scanning for vulnerabilities, and avoiding running containers as root. These practices minimize the attack surface, reduce risks, and ensure a secure deployment environment. Hardcoding credentials and adding unnecessary packages are security risks and should be avoided in production-grade container images.
- A. Correct.
Using a minimal base image reduces the number of potential vulnerabilities in the container by limiting the software included in the image.
- B. Incorrect.
Hardcoding credentials in the container image is a bad practice as it can lead to sensitive information exposure if the image is compromised.
- C. Correct.
Regularly scanning the container image for vulnerabilities helps identify and address security issues before deploying the container.
- D. Correct.
Running the application as a non-root user minimizes the potential damage an attacker could cause if the container is compromised.
- E. Incorrect.
Installing unnecessary packages increases the attack surface of the container and should be avoided to maintain security.