0
0
Dockerdevops~10 mins

Cache mount for faster builds 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 use a cache mount for faster builds.

Docker
RUN --mount=type=[1],target=/root/.cache pip install -r requirements.txt
Drag options to blanks, or click blank then click option'
Atmpfs
Bcache
Cbind
Dvolume
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'bind' instead of 'cache' causes no caching and slower builds.
Using 'tmpfs' mounts a temporary filesystem that is cleared after the build step.
2fill in blank
medium

Complete the Dockerfile RUN command to specify the cache mount with an ID.

Docker
RUN --mount=type=cache,[1]=mycache,target=/root/.cache pip install -r requirements.txt
Drag options to blanks, or click blank then click option'
Aid
Bkey
Csource
Dname
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'name' instead of 'id' causes Docker to ignore the cache.
Omitting the cache ID causes a new cache to be created every build.
3fill in blank
hard

Fix the error in this Dockerfile RUN command to correctly use cache mount syntax.

Docker
RUN --mount=type=[1],target=/root/.cache,id=mycache pip install -r requirements.txt
Drag options to blanks, or click blank then click option'
Acache
Bbind
Ctmpfs
Dvolume
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'bind' or 'tmpfs' instead of 'cache' causes build errors.
Forgetting to specify the cache ID.
4fill in blank
hard

Fill both blanks to create a cache mount with an ID and target directory.

Docker
RUN --mount=type=[1],[2]=mycache,target=/root/.cache pip install -r requirements.txt
Drag options to blanks, or click blank then click option'
Acache
Bid
Cname
Dsource
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'name' or 'source' instead of 'id' for the cache identifier.
Using a mount type other than 'cache'.
5fill in blank
hard

Fill all three blanks to create a cache mount with an ID, target directory, and sharing mode.

Docker
RUN --mount=type=[1],[2]=mycache,target=[3] pip install -r requirements.txt
Drag options to blanks, or click blank then click option'
Acache
Bid
C/root/.cache
Dshared
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'shared' as the target directory.
Mixing up the order of options.
Omitting the cache ID.