Challenge - 5 Problems
Docker ML Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1: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)"
Attempts:
2 left
💡 Hint
Think about what the python command inside the container does.
✗ Incorrect
The command runs a Python one-liner inside the official python:3.9-slim container, printing the sum 5.
🧠 Conceptual
intermediate1:30remaining
Why use Docker for ML reproducibility?
Which of the following best explains why Docker helps with reproducibility in machine learning projects?
Attempts:
2 left
💡 Hint
Think about what Docker containers include.
✗ Incorrect
Docker containers bundle the code, libraries, and environment, ensuring consistent runs across different machines.
❓ Configuration
advanced2: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"]
Attempts:
2 left
💡 Hint
The command must tell pip to read the requirements file.
✗ Incorrect
The correct syntax to install dependencies from a requirements file is 'pip install -r requirements.txt'.
❓ Troubleshoot
advanced2:00remaining
Why does this Docker container fail to find the ML script?
You build and run a Docker container but get an error:
What is the most likely cause?
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?
Attempts:
2 left
💡 Hint
Check what files are available when building the image.
✗ Incorrect
If train.py is not in the folder used to build the image, it won't be copied into /app, causing the error.
🔀 Workflow
expert2: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:
Attempts:
2 left
💡 Hint
Think about preparing code before writing Dockerfile and building image.
✗ Incorrect
First prepare code, then write Dockerfile, build image, and finally run container.