Google Professional Cloud Developer Question 249
Select 4Google Cloud PlatformYou are creating a container image for a web application that needs to be deployed on Google Kubernetes Engine (GKE). To ensure the container image is secure, which practices should you follow during the image creation process?
- A
Use a base image from a trusted source and regularly update it.
- B
Include sensitive information such as API keys directly in the image for easier access.
- C
Scan the container image for vulnerabilities before pushing it to the container registry.
- D
Run the application in the container as a non-root user.
- E
Reduce the image size by only including necessary dependencies.
Show answer and explanation
Correct answers: A, C, D, E
Explanation
Creating secure container images involves several best practices to minimize vulnerabilities and risks. Trusted base images ensure a solid foundation, while scanning for vulnerabilities and running as a non-root user enhances security. Avoiding sensitive data in the image and keeping the image lean further reduces potential attack vectors. Following these practices is essential for deploying secure applications on Google Cloud.
- A. Correct.
Using a base image from a trusted source reduces the risk of introducing vulnerabilities or malicious code into your container.
- B. Incorrect.
Including sensitive information, such as API keys, directly in the image is insecure and exposes secrets to anyone with access to the image.
- C. Correct.
Scanning the container image for vulnerabilities helps identify and address any security issues before deployment.
- D. Correct.
Running the application as a non-root user minimizes the impact of a potential compromise, as the attacker would not have administrative privileges.
- E. Correct.
Reducing the image size decreases the attack surface and improves performance by removing unnecessary components.