dbd2d06659
Issue #34 reports container Recreate / native auto-update (#28, #10) failing on modern Docker Engines via the agent with "starting container with non-empty request body ... removed in v1.24". The proposed fix: make API-version resolution robust in all three docker client constructors. - api/docker/client/client.go: add a shared negotiateWithFloor() used by createLocalClient, createTCPClient, createAgentClient. It eagerly NegotiateAPIVersion (10s bound) instead of relying on lazy first-call negotiation, and enforces a modern floor: if the negotiated version is empty or < 1.24 (versions.LessThan), rebuild pinned at 1.44 (WithVersion, which the SDK requires INSTEAD of negotiation — WithVersion sets manualOverride, disabling NegotiateAPIVersion). Negotiation stays primary; the floor is only a safety net. Effective API version is now guaranteed >= 1.24. Custom transport / TLS / agent headers untouched. - Tests (api/docker/client/client_test.go): modern daemon -> empty start body; below-floor daemon -> pinned to floor; unreachable daemon -> stays >= 1.24. IMPORTANT FINDING (needs maintainer confirmation before this is called a complete fix for #34): on the pinned SDK (github.com/docker/docker v28.5.2), ContainerStart posts a nil body UNCONDITIONALLY (client/container_start.go: cli.post(ctx, ".../start", query, nil, nil) — no version branch), and NewClientWithOpts defaults to version 1.51 (negotiation only downgrades). So on develop, the server-side path the issue names (autoupdate.go -> Recreate -> cli.ContainerStart) cannot emit a request body regardless of API version — this change hardens the client path but is unlikely to be the actual source of the reported symptom. The "non-empty body" more likely originates from a DIFFERENT layer (an OLDER docker SDK in the failing deployment, where ContainerStart did attach HostConfig at API < 1.24; or the docker PROXY forwarding a raw browser request). Recommend confirming the failing environment's build before merging as the #34 fix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>