Docker Lab Run Flow
Run the Docker Lab Run Flow MicroSim Fullscreen
About This MicroSim
A runnable code block of the Docker Python Lab Type shows editable Python with Run and Reset buttons and an output area. The code does not run in the browser. It travels along a path of five parts, and a lab fails when any one of them is missing:
- Lab page - the textarea, the Run and Reset buttons and the output area, whose IDs all end
in the same suffix, such as
-1 - docker-lab.js - the shared script, listed in
mkdocs.yml, that definesrunDocker() - Local service on port 5001 - started with
bash scripts/run-python-docker.sh - Fresh Docker container - the Lab Sandbox, a new
python:3.11-alpinecontainer for every run, with only the standard library, no standard input and no persistent files - Output area - where the printed text, or a red error, appears
The arrows show the round trip: Run clicked, code sent, container started, text returned and output displayed. Hover any arrow to see exactly what travels along it.
The Break it menu offers five failures: the service is not started, the script is missing
from mkdocs.yml, the starter program calls input(), the starter imports a third-party
package, and the Run button calls the wrong suffix. With Diagnose first checked, you see
only the symptom, such as "You click Run and nothing happens," and you click the part you
think is broken. The broken part then turns red and the panel explains the cause and the fix,
for example "run bash scripts/run-python-docker.sh, then reload the page." Mystery:
symptom only picks a failure at random and hides its name as well.
Learning objective: The learner will diagnose why a lab fails to run by identifying which part of the path from browser to container is missing.
Bloom's taxonomy level: Analyze (verb: diagnose)
How to Use
- Click each of the five parts to read its role and one thing that can break it.
- Hover each arrow and say what travels along it.
- Choose a failure in Break it. Read the symptom and click the part you think is broken. A wrong click gives a hint. A right click shows the red part, the cause and the fix.
- Uncheck Diagnose first to see the answer immediately, or choose Mystery: symptom only to diagnose without the failure's name.
When the page is narrower than 600 pixels, the five parts form a column.
Iframe Embed Code
You can add this MicroSim to any web page by adding this to your HTML:
1 2 3 4 | |
Lesson Plan
Audience
Teachers, instructional designers, learning-technology developers and learning-analytics practitioners (college undergraduate and professional development).
Duration
15 minutes
Prerequisites
- The Runnable Code Blocks and the Lab Sandbox section of Chapter 11
- Basic familiarity with a browser's developer console
Activities
- Trace (3 min): Hover the five arrows in order and write one line for each describing what travels along it.
- Diagnose (7 min): With Diagnose first checked, work through all five failures. Record how many took more than one click.
- Compare (5 min): Two failures make Run appear to "do nothing." Explain which clue in the symptom (a console error, or none at all) separates the missing script from the mismatched suffix.
Assessment
- Three Mystery rounds diagnosed on the first click.
- A written comparison of the "nothing happens" symptoms and the part each points to.
- Given a new symptom, such as "ModuleNotFoundError: No module named 'requests'", the learner names the broken part and a fix.
References
- Docker (software) - Wikipedia - Background on containers, the isolation that makes each lab run a fresh sandbox.
- Standard streams - Wikipedia - Standard
input and output, and why
input()fails when a program has no standard input. - Python built-in exceptions: EOFError -
The error raised when
input()reaches the end of its input. - MkDocs configuration: extra_javascript -
The
mkdocs.ymlsetting that loadsdocker-lab.json every page.