0
0
MLOpsdevops~20 mins

Docker for ML reproducibility in MLOps - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Docker ML Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
What is the output of this Docker command?
You run the command docker run --rm python:3.9-slim python -c "print(2+3)". What will be the output?
MLOps
docker run --rm python:3.9-slim python -c "print(2+3)"
A5
Bpython:3.9-slim: command not found
CError: No such image: python:3.9-slim
D2+3
Attempts:
2 left
💡 Hint
Think about what the python command inside the container does.
🧠 Conceptual
intermediate
1:30remaining
Why use Docker for ML reproducibility?
Which of the following best explains why Docker helps with reproducibility in machine learning projects?
ADocker provides a cloud service to train ML models faster.
BDocker automatically improves ML model accuracy by optimizing code.
CDocker replaces the need for data preprocessing in ML pipelines.
DDocker packages code, dependencies, and environment so ML runs the same everywhere.
Attempts:
2 left
💡 Hint
Think about what Docker containers include.
Configuration
advanced
2:00remaining
Which Dockerfile snippet correctly installs Python dependencies for ML?
You want to create a Docker image for your ML project. Which Dockerfile snippet correctly installs dependencies from requirements.txt?
MLOps
FROM python:3.8-slim
COPY requirements.txt ./
RUN ???
COPY . ./app
WORKDIR /app
CMD ["python", "train.py"]
ARUN pip install -r ./app/requirements.txt
BRUN pip install requirements.txt
CRUN pip install -r requirements.txt
DRUN install pip -r requirements.txt
Attempts:
2 left
💡 Hint
The command must tell pip to read the requirements file.
Troubleshoot
advanced
2:00remaining
Why does this Docker container fail to find the ML script?
You build and run a Docker container but get an error: python: can't open file 'train.py': [Errno 2] No such file or directory. The Dockerfile is:
FROM python:3.8-slim
COPY . /app
WORKDIR /app
CMD ["python", "train.py"]

What is the most likely cause?
AThe WORKDIR is set after CMD, so the command runs in the wrong directory.
BThe <code>train.py</code> file is missing in the build context directory.
CThe COPY command should be <code>COPY /app .</code> instead.
DPython is not installed in the python:3.8-slim image.
Attempts:
2 left
💡 Hint
Check what files are available when building the image.
🔀 Workflow
expert
2:30remaining
Order the steps to create a Docker image for ML reproducibility
Arrange these steps in the correct order to create and run a Docker container for an ML project:
A4,1,2,3
B1,4,2,3
C4,2,1,3
D1,2,4,3
Attempts:
2 left
💡 Hint
Think about preparing code before writing Dockerfile and building image.