Skip to content

Handle attached Docker run output - #61

Open
X1pheR wants to merge 1 commit into
ckreiling:mainfrom
X1pheR:fix/attached-run-output
Open

Handle attached Docker run output#61
X1pheR wants to merge 1 commit into
ckreiling:mainfrom
X1pheR:fix/attached-run-output

Conversation

@X1pheR

@X1pheR X1pheR commented Aug 8, 2026

Copy link
Copy Markdown

Summary

Handle the Docker SDK return type for run_container(detach=false) instead of passing attached command output to docker_to_dict().

Problem

docker.containers.run(..., detach=False) returns command output bytes. The current tool always calls docker_to_dict() on the result, which only supports Docker model objects, so attached execution fails during result conversion even when the command itself succeeded.

Change

  • Preserve the existing Docker-object response for detached execution.
  • Return attached command output as structured {mode: "attached", output: ...} data.
  • Decode invalid UTF-8 using replacement rather than failing result serialization.
  • Reject unexpected return types explicitly.

This PR intentionally does not add output-size policy; it only fixes the Docker SDK type contract.

Validation

  • ruff check src tests
  • pytest -q: 6 passed
  • Live MCP validation with alpine:latest and detach=false returned the expected command output successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant