fix(cli): support docker model logs from WSL2 with Docker Desktop#761
Merged
doringeman merged 1 commit intodocker:mainfrom Mar 18, 2026
Merged
fix(cli): support docker model logs from WSL2 with Docker Desktop#761doringeman merged 1 commit intodocker:mainfrom
doringeman merged 1 commit intodocker:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The new
linuxbranch in the OS switch assumes WSL2 with Docker Desktop; consider detecting WSL explicitly (e.g., viaWSL_DISTRO_NAMEor checkingwslvaravailability) and either falling back or using a different path on native Linux to avoid misrouting logs on non-WSL Linux hosts. - You unconditionally enable
Pollmode for all Linux platforms; it might be safer to tie this to the same WSL detection used for resolving the Windows home directory so native Linux tails continue using the default, more efficient behavior.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new `linux` branch in the OS switch assumes WSL2 with Docker Desktop; consider detecting WSL explicitly (e.g., via `WSL_DISTRO_NAME` or checking `wslvar` availability) and either falling back or using a different path on native Linux to avoid misrouting logs on non-WSL Linux hosts.
- You unconditionally enable `Poll` mode for all Linux platforms; it might be safer to tie this to the same WSL detection used for resolving the Windows home directory so native Linux tails continue using the default, more efficient behavior.
## Individual Comments
### Comment 1
<location path="cmd/cli/commands/logs.go" line_range="78-85" />
<code_context>
case "windows":
serviceLogPath = filepath.Join(homeDir, "AppData/Local/Docker/log/host/inference.log")
runtimeLogPath = filepath.Join(homeDir, "AppData/Local/Docker/log/host/inference-llama.cpp-server.log")
+ case "linux":
+ // When running inside WSL2 with Docker Desktop, the log files
+ // are on the Windows host filesystem mounted under /mnt/.
+ winHomeDir, wslErr := windowsHomeDirFromWSL(cmd.Context())
+ if wslErr != nil {
+ return fmt.Errorf("unable to determine Windows home directory from WSL2: %w", wslErr)
+ }
+ serviceLogPath = filepath.Join(winHomeDir, "AppData/Local/Docker/log/host/inference.log")
+ runtimeLogPath = filepath.Join(winHomeDir, "AppData/Local/Docker/log/host/inference-llama.cpp-server.log")
default:
</code_context>
<issue_to_address>
**issue (bug_risk):** Linux handling assumes WSL2 tools are present, which breaks on non-WSL Linux environments.
This branch treats all Linux environments as WSL2 with Docker Desktop and requires `wslvar`/`wslpath`. On native Linux, this will always fail, even though logs may be elsewhere or behavior should differ.
Please either:
- Detect WSL explicitly (e.g., via `WSL_INTEROP`, `/proc/version`, etc.) before calling `windowsHomeDirFromWSL`, or
- Provide a separate code path or clearer error for non-WSL Linux so native Linux users don’t hit a WSL-specific failure.
Currently this change effectively makes WSL tooling a requirement for all Linux users.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds support for docker model logs within a WSL2 environment by correctly locating log files on the Windows host filesystem. The implementation correctly uses wslvar and wslpath to resolve the path and enables polling for file changes, which is necessary for this setup. My review includes a suggestion to refactor the code that determines log file paths to reduce duplication between the Windows and Linux (WSL) cases, which will improve the code's maintainability.
Signed-off-by: Dorin Geman <dorin.geman@docker.com>
ilopezluna
approved these changes
Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the third issue reported in #750.
Enable
docker model logswithin WSL2 Docker Desktop integrated distro.