Host paths on macOS and Windows
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 offline evidence. Before any separately authorized server query, verify the effective endpoint and its trust boundary, including context overrides. Do not change runtime state, mount host data or modify Desktop settings in this exercise.
Illustrative path mapping (no mount performed):macOS shell source: /Users/learner/demoWindows PowerShell source: C:\Users\learner\demoWSL shell source: /home/learner/demoLinux container destination: /workspaceRemote Linux daemon: source must exist on that daemon hostSynthetic filenames: note.txt, data.jsonA Linux container expects a Linux path such as /workspace even when the host uses drive letters. Select a shell-specific absolute source path and quote the entire --mount argument when it contains spaces; shell quoting and path conversion can differ. The long form uses type=bind,source=...,target=/workspace,readonly; a missing source normally produces an error unless source creation is explicitly requested. Desktop translates supported host paths into its VM. With a remote daemon, a local client path is not a file upload. For portable Compose projects, prefer relative project paths where appropriate and validate the resolved configuration in each environment; keep the project root and merge rules in mind. Only mount a dedicated synthetic directory, never a home directory or credential store. macOS and Windows installation requirements change: match the installer to host architecture, check supported OS and virtualization requirements in official docs and obtain approval before installation. For the variation, map /Users/learner/My Demo or C:\Users\learner\My Demo to /app using the corresponding shell and verified sharing rules. A relative Compose source is not universally portable across remote engines; confirm the resolved source and approved destination before use.
Common mistake
Do not copy a PowerShell drive-letter source unchanged into a WSL shell, or use a Windows drive-letter destination in a Linux container.
Manual practice
Map a synthetic directory named My Demo from macOS and Windows to /app, then explain why the same local path may fail with a remote daemon. Do not execute a mount.
Worksheet: lab-fixtures/docker-desktop-portability/02-host-paths/scenario.txt.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Host paths on macOS and Windows — Knowledge check
Interpret synthetic cross-platform evidence and identify missing compatibility or entitlement checks.
What destination fits a Linux container?
Where is a bind source interpreted for a remote daemon?
What is a good mount scope for practice?