Skip to content

Conversation

@thomhurst
Copy link

@thomhurst thomhurst commented Dec 30, 2025

Summary

Improves Unix socket connection handling to work better with Docker socket proxy wrappers (like those used in some CI environments such as custom GitHub runners with DinD).

Changes

  • For .NET 8+: Use SocketsHttpHandler with ConnectCallback instead of the legacy ManagedHandler
  • For all platforms: Add KeepAlive socket option for better proxy compatibility
  • New configuration: Add SocketConnectTimeout property (default 30 seconds)
  • Improved error handling: Proper socket disposal on connection failure

Files Changed

File Change
DockerClientConfiguration.cs Added SocketConnectTimeout parameter/property
DockerClient.cs SocketsHttpHandler for .NET 8+, improved ManagedHandler for .NET Standard
DockerClientConfigurationTests.cs Unit tests for configuration defaults

Test plan

  • Unit tests pass
  • CI integration tests on Ubuntu

🤖 Generated with Claude Code

@thomhurst thomhurst force-pushed the feat/improve-unix-socket-handling branch from 771ee02 to 09cd6c3 Compare December 30, 2025 11:05
- Use SocketsHttpHandler with ConnectCallback for .NET 8+ (more robust)
- Add KeepAlive socket option for better proxy socket compatibility
- Add configurable UnixSocketConnectTimeout (default 30s)
- Improve error handling with proper socket disposal
- Add unit tests for DockerClientConfiguration

This change addresses issues with Docker socket proxy wrappers (like those
used in some CI environments) that may not work with the legacy ManagedHandler.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@thomhurst thomhurst force-pushed the feat/improve-unix-socket-handling branch from 09cd6c3 to f329d87 Compare December 30, 2025 11:12
Copilot AI review requested due to automatic review settings January 2, 2026 10:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves Unix socket connection handling to better support Docker socket proxy wrappers commonly used in CI environments like custom GitHub runners with Docker-in-Docker (DinD). The implementation adds configurable connection timeouts and switches to modern SocketsHttpHandler for .NET 8+.

Key Changes:

  • Introduced SocketConnectTimeout configuration property with a 30-second default timeout
  • Migrated .NET 8+ Unix socket connections from ManagedHandler to SocketsHttpHandler with ConnectCallback
  • Added KeepAlive socket option for improved proxy compatibility across all platforms

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
DockerClientConfiguration.cs Adds SocketConnectTimeout parameter/property with default value of 30 seconds
DockerClient.cs Implements modern SocketsHttpHandler for .NET 8+ and timeout handling with KeepAlive for all platforms
DockerClientConfigurationTests.cs New unit tests validating default and custom timeout configuration values
IContainerOperationsTests.cs Changes ThrowsAsync to ThrowsAnyAsync for more accurate cancellation exception assertions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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