Challenge - 5 Problems
Development Container Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Output of multi-stage Docker build
Consider this Dockerfile using multi-stage build pattern:
FROM node:18 AS builder WORKDIR /app COPY package.json . RUN npm install COPY . . RUN npm run build FROM nginx:alpine COPY --from=builder /app/build /usr/share/nginx/htmlWhat will be the output when running
docker images after building this Dockerfile with docker build -t myapp .?Attempts:
2 left
💡 Hint
Multi-stage builds keep only the final stage as the image unless you tag intermediate stages.
✗ Incorrect
Multi-stage builds produce a single final image named as specified. Intermediate stages are not saved as separate images unless explicitly tagged.
❓ Configuration
intermediate2:00remaining
Correct Dockerfile pattern for caching dependencies
You want to optimize your Dockerfile to cache dependencies and avoid reinstalling them on every build. Which Dockerfile snippet correctly implements this pattern?
Attempts:
2 left
💡 Hint
Think about which files change less often and how Docker caches layers.
✗ Incorrect
Copying package.json first and running npm install before copying the rest allows Docker to cache the dependencies layer if package.json hasn't changed.
❓ Troubleshoot
advanced2:00remaining
Why does my container fail to start with permission denied?
You have this Dockerfile snippet:
When running the container, you get a permission denied error on app.py. What is the most likely cause?
FROM python:3.12-slim WORKDIR /app COPY . . RUN pip install -r requirements.txt CMD ["python", "app.py"]
When running the container, you get a permission denied error on app.py. What is the most likely cause?
Attempts:
2 left
💡 Hint
Check file permissions inside the container for scripts.
✗ Incorrect
COPY preserves file permissions from the host. If app.py lacks execute permission, the container cannot run it, causing permission denied.
🔀 Workflow
advanced2:00remaining
Order of steps in a development container workflow
Arrange these steps in the correct order for a typical development container workflow:
1. Run the container interactively
2. Write or edit code on the host
3. Build the Docker image
4. Mount source code into the container
1. Run the container interactively
2. Write or edit code on the host
3. Build the Docker image
4. Mount source code into the container
Attempts:
2 left
💡 Hint
Think about when you build, mount, and edit code during development.
✗ Incorrect
First build the image, then mount the source code, then edit code on the host, finally run the container interactively to see changes live.
✅ Best Practice
expert2:00remaining
Choosing the best base image for a development container
You want a development container for a Node.js app that is fast to build, small in size, and supports debugging tools. Which base image is the best choice?
Attempts:
2 left
💡 Hint
Consider trade-offs between image size, build speed, and tool availability.
✗ Incorrect
node:18-slim balances small size and compatibility with debugging tools better than alpine (too minimal) or full images (larger).