Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Professional Cloud Architect All Questions

View all questions & answers for the Professional Cloud Architect exam

Exam Professional Cloud Architect topic 1 question 22 discussion

Actual exam question from Google's Professional Cloud Architect
Question #: 22
Topic #: 1
[All Professional Cloud Architect Questions]

One of the developers on your team deployed their application in Google Container Engine with the Dockerfile below. They report that their application deployments are taking too long.

You want to optimize this Dockerfile for faster deployment times without adversely affecting the app's functionality.
Which two actions should you take? (Choose two.)

  • A. Remove Python after running pip
  • B. Remove dependencies from requirements.txt
  • C. Use a slimmed-down base image like Alpine Linux
  • D. Use larger machine types for your Google Container Engine node pools
  • E. Copy the source after he package dependencies (Python and pip) are installed
Show Suggested Answer Hide Answer
Suggested Answer: CE 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
aviratna
Highly Voted 3 years, 5 months ago
C & E: C: Smaller the base image with minimum dependency faster the container will start E: Docker image build uses caching. Docker Instructions sequence matter because application’s dependencies change less frequently than the Python code which will help to reuse the cached layer of dependency and only add new layer for code change for Python Source code.
upvoted 56 times
...
vincy2202
Highly Voted 3 years ago
C & E are the correct answers. Kindly refer - https://www.docker.com/blog/intro-guide-to-dockerfile-best-practices/
upvoted 12 times
...
Ekramy_Elnaggar
Most Recent 1 week, 4 days ago
Selected Answer: CE
C. Use a slimmed-down base image like Alpine Linux: The ubuntu:16.04 image is a full-fledged operating system, which means it's larger and takes longer to download and build. Alpine Linux is a minimal distribution designed for containers, resulting in significantly smaller images and faster deployments. E. Copy the source after the package dependencies (Python and pip) are installed: Docker builds images in layers. Each RUN, COPY, and ADD instruction creates a new layer. By copying the source code after installing dependencies, you can take advantage of Docker's caching mechanism. If your source code changes, only the layers related to the source code need to be rebuilt, not the layers related to dependencies.
upvoted 1 times
...
alessandroGPC
7 months ago
Hi everyone, I have a doubt. The question talks about "deployment" not "build". CE are more correct, in my opinion, to accelerate the build phase (and application management) rather than the simple deployment (with docker swarm, simple docker, kubernetes etc etc)
upvoted 1 times
...
nickcin77
11 months ago
C&E C - Use small images. E - "Try to make expensive steps appear near the beginning of the Dockerfile. Steps that change often should appear near the end of the Dockerfile" https://docs.docker.com/build/cache/
upvoted 3 times
...
jrisl1991
1 year, 2 months ago
Selected Answer: CE
C is an obvious choice, as an optimized image will be much better for a container than the one in the file. For E, I found an explanation here about COPY that helped me confirm that's the other solution - https://test-dockerrr.readthedocs.io/en/latest/userguide/eng-image/dockerfile_best-practices/#:~:text=required%20files%20change.-,For%20example%3A,-COPY%20requirements.txt.
upvoted 1 times
...
poplot321
1 year, 4 months ago
I know C & E makes the most sense, but the Dockerfile is has a bug. If you don't copy requirements.txt from source, you have nothing to pip install. The line after FROM should be: COPY requirements.txt requirements.txt
upvoted 4 times
...
Badri9898
1 year, 7 months ago
The two actions that should be taken to optimize the Dockerfile for faster deployment times without adversely affecting the app's functionality are: B. Remove dependencies from requirements.txt: The requirements.txt file should only contain necessary dependencies to reduce the number of packages to be installed. C. Use a slimmed-down base image like Alpine Linux: The Alpine Linux image is smaller than Ubuntu and has a smaller attack surface, which reduces the container's build time and image size. Therefore, options A, D, and E are not correct as they do not directly address the issue of slow deployment times caused by a bloated Dockerfile.
upvoted 1 times
jrisl1991
1 year, 2 months ago
But how do you know that requirements.txt has other dependencies? We don't have the file to confirm if there are unnecessary dependencies. Assuming that we only have the necessary ones, removing dependencies would break the deployment.
upvoted 1 times
...
...
alekonko
1 year, 8 months ago
Selected Answer: CE
C: use smaller image decrease pull time E: optimize build time using previous cache layer image. generate new layer only for a different app code and requirements A: can't remove python B: the developer choose right deps D: changing istance type don't directly reduce deploy time
upvoted 2 times
...
omermahgoub
1 year, 11 months ago
C & E Using a slimmed-down base image like Alpine Linux can help reduce the size of your Docker image, which can lead to faster deployment times. Alpine Linux is a lightweight Linux distribution that is often used as a base image for Docker images because of its small size. Additionally, copying the source code after installing the package dependencies can help reduce the image build time because the dependencies will only need to be installed once, rather than every time the source code is changed. This can lead to faster deployment times because the image build process will be faster.
upvoted 6 times
omermahgoub
1 year, 11 months ago
It is not recommended to remove dependencies from the requirements.txt file or remove Python after running pip, as this could adversely affect the functionality of the application. Similarly, using larger machine types for your Google Container Engine node pools may not directly affect the deployment times of your application, as the deployment times are primarily dependent on the size and complexity of the Docker image being deployed.
upvoted 1 times
...
...
sfsdeniso
2 years, 1 month ago
B & E base image is already cached - so no improvement in build time B is about removing unnecessary dependencies and not about all of them i remember saw this question on google's site - BE are correct
upvoted 2 times
...
AzureDP900
2 years, 1 month ago
CE and is perfect
upvoted 1 times
...
minmin2020
2 years, 1 month ago
Selected Answer: CE
C. Use a slimmed-down base image like Alpine Linux E. Copy the source after he package dependencies (Python and pip) are installed
upvoted 1 times
...
backhand
2 years, 4 months ago
vote C, E https://cloud.google.com/architecture/best-practices-for-building-containers
upvoted 1 times
...
MathMedrado
2 years, 4 months ago
As far as I know, it is necessary to copy the requirements.txt first in order to run pip, it is not possible to run pip without first copying the requirements.txt. if they copy requirements.txt first then E would work.
upvoted 2 times
...
amxexam
2 years, 6 months ago
Selected Answer: CE
By means of elimination A B, dont make sence.D . is optimizing the mackie not script. Hence we are left with C& E
upvoted 3 times
...
potorange
2 years, 6 months ago
Selected Answer: CE
C.Alpine is a ligweight Linux distro, with smaller image E. Pushing often changing files down the Dockerfile helps reducing image layers variations. Both help faster image pull operations
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...