Wrong Docker context and unexpected resources
Worked example
This is an offline lesson. Data are fictional and Docker commands are unexecuted. Any optional execution requires an authorized disposable VM, a verified context, synthetic data, restricted access and no external transmission. Do not collect secrets or private output. Treat the worksheet as evidence to analyze, not a script to paste. Before any authorized observation confirm the actual endpoint, object identity, time window and output budget. Do not repair, restart or delete resources during this offline exercise.
Fictional context inventory:expected: bm-lab (approved disposable VM)stored default: bm-labDOCKER_CONTEXT: other-contextobserved resources: unknownStaged local checks:docker context showdocker context lsdocker context inspect bm-lab# Only after approval of endpoint and environment:docker --context bm-lab ps -aCheck the intended environment against the CLI flags, DOCKER_CONTEXT and DOCKER_HOST before querying the daemon. A context inspection shows local metadata; it may contain private endpoints, so do not publish it. DOCKER_CONTEXT can override DOCKER_HOST and the stored context; the explicit --context option selects a named context. Avoid mixing context and host options. Use an explicit approved context for a read-only query only after inspecting its endpoint and access configuration. If the inventory becomes correct, the issue was target selection rather than deleted containers. Record the chosen target in incident notes and scripts. Restore the original selection if a change was approved; no persistent context switch is required for this exercise. The explicit context query is conditional on a separately trusted endpoint and account; a context name or saved metadata alone cannot authenticate a server. Inspect local overrides and credential configuration without exposing values.
Common mistake
Do not recreate missing resources or run cleanup commands until you know which daemon you are addressing.
Manual practice
Explain the mismatch in the inventory. Write the explicit read-only query after verifying bm-lab and describe which environment settings you would review without printing their values.
Worksheet: lab-fixtures/docker-troubleshooting/02-context/scenario.txt.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Wrong Docker context and unexpected resources — Knowledge check
Interpret synthetic incident evidence and choose safe diagnostic actions.
Expected containers are absent on an unexpected context. First action?
Which selects an approved named context for one query?
Why redact context inspection output?