0
0
Dockerdevops~20 mins

Building images in CI pipeline in Docker - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Docker CI Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
Output of Docker build with cache disabled
What will be the output status of the following command when run in a CI pipeline?
docker build --no-cache -t myapp:latest .
Docker
docker build --no-cache -t myapp:latest .
ABuild command is invalid and returns a syntax error.
BBuild fails due to missing cache layers.
CBuild uses cached layers and completes faster.
DBuild completes successfully creating a new image without using any cached layers.
Attempts:
2 left
💡 Hint
The --no-cache option forces Docker to ignore cached layers.
Best Practice
intermediate
1:30remaining
Choosing the best base image in CI builds
In a CI pipeline, which base image choice is best to minimize build time and image size for a Node.js application?
AUse the full 'node:latest' image with all tools included.
BUse 'node:alpine' image which is smaller and lightweight.
CUse 'ubuntu:latest' and install Node.js manually during build.
DUse 'scratch' base image with no pre-installed software.
Attempts:
2 left
💡 Hint
Smaller base images reduce download and build time in CI.
Troubleshoot
advanced
2:00remaining
Diagnosing Docker build failure in CI
A CI pipeline fails at the Docker build step with the error:
failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /workspace/Dockerfile: no such file or directory

What is the most likely cause?
AThe Dockerfile syntax has errors causing parsing failure.
BDocker daemon is not running on the CI server.
CThe Dockerfile is missing or not in the build context directory.
DThe image tag name is invalid.
Attempts:
2 left
💡 Hint
Check the location and presence of the Dockerfile in the repository.
🔀 Workflow
advanced
2:30remaining
Correct order of steps in a CI Docker build pipeline
Arrange the following steps in the correct order for a typical CI pipeline that builds and pushes a Docker image:
A4, 2, 3, 1
B4, 3, 2, 1
C2, 4, 3, 1
D3, 4, 2, 1
Attempts:
2 left
💡 Hint
You need source code before testing and building, and push last.
🧠 Conceptual
expert
3:00remaining
Effect of multi-stage builds on CI pipeline efficiency
How do multi-stage Docker builds improve CI pipeline efficiency?
AThey reduce the final image size by separating build and runtime stages, speeding up deployment.
BThey allow parallel builds of multiple images in one Dockerfile.
CThey cache all intermediate layers to speed up rebuilds regardless of changes.
DThey automatically push images to multiple registries simultaneously.
Attempts:
2 left
💡 Hint
Think about how separating build tools from runtime affects image size.