0
0
Dockerdevops~10 mins

Layer caching and ordering in Docker - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the Dockerfile line to set the base image.

Docker
FROM [1]
Drag options to blanks, or click blank then click option'
Aubuntu:20.04
BRUN apt-get update
CCOPY . /app
DEXPOSE 80
Attempts:
3 left
💡 Hint
Common Mistakes
Using RUN or COPY instead of FROM for the base image.
Forgetting to specify a tag for the image.
2fill in blank
medium

Complete the Dockerfile line to copy files into the image.

Docker
COPY [1] /app
Drag options to blanks, or click blank then click option'
Aapp/
Bapt-get update
C/app
DRUN
Attempts:
3 left
💡 Hint
Common Mistakes
Using commands like RUN instead of a path.
Using absolute paths incorrectly.
3fill in blank
hard

Fix the error in the Dockerfile line to install packages.

Docker
RUN apt-get [1] && apt-get install -y curl
Drag options to blanks, or click blank then click option'
Ainstall
Bupgrade
Cupdate
Dremove
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'install' instead of 'update' in the first command.
Using 'remove' which deletes packages.
4fill in blank
hard

Fill both blanks to create a cache-friendly Dockerfile line that installs packages.

Docker
RUN apt-get [1] && apt-get [2] -y curl wget
Drag options to blanks, or click blank then click option'
Aupdate
Binstall
Cremove
Dupgrade
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the order of commands.
Using 'remove' or 'upgrade' incorrectly.
5fill in blank
hard

Fill all three blanks to create a cache-efficient Dockerfile snippet that copies files, installs dependencies, and cleans up.

Docker
COPY [1] /app
RUN apt-get update && apt-get [2] -y python3-pip && apt-get [3] -y
Drag options to blanks, or click blank then click option'
Arequirements.txt
Binstall
Cautoremove
Dupdate
Attempts:
3 left
💡 Hint
Common Mistakes
Copying wrong files.
Using 'update' instead of 'install' for package installation.
Not cleaning up unused packages.