Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the Dockerfile line to set the base image.
Docker
FROM [1] Drag options to blanks, or click blank then click option'
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.
✗ Incorrect
The FROM instruction sets the base image for the Docker build. 'ubuntu:20.04' is a valid base image.
2fill in blank
mediumComplete the Dockerfile line to copy files into the image.
Docker
COPY [1] /app Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using commands like RUN instead of a path.
Using absolute paths incorrectly.
✗ Incorrect
COPY copies files or directories from the source (here 'app/') to the destination inside the image.
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'install' instead of 'update' in the first command.
Using 'remove' which deletes packages.
✗ Incorrect
The command 'apt-get update' updates package lists. 'install' is used later to install packages.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the order of commands.
Using 'remove' or 'upgrade' incorrectly.
✗ Incorrect
First, 'apt-get update' refreshes package lists. Then, 'apt-get install -y' installs the packages.
5fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Copying wrong files.
Using 'update' instead of 'install' for package installation.
Not cleaning up unused packages.
✗ Incorrect
Copy the requirements file first, then install packages, and finally clean unused packages to keep image size small.