diff --git a/internal/docker/docker.go b/internal/docker/docker.go index 1c8cd44d..3d521f77 100644 --- a/internal/docker/docker.go +++ b/internal/docker/docker.go @@ -6,13 +6,17 @@ import ( "github.com/docker/docker/client" ) +// dockerAPIVersion specifies the Docker API version to use for all client operations. +// Version 1.41 is stable and widely supported, ensuring compatibility with archive endpoints +// used by ContainerStatPath and other container operations. +const dockerAPIVersion = "1.41" + // Initialize Docker client from environment variables -// Uses API version 1.41 explicitly to ensure compatibility with archive endpoints -// API version 1.41 is stable and widely supported across Docker versions +// Uses explicit API version to ensure compatibility with archive endpoints func initClient() (cli *client.Client, err error) { // Use explicit API version instead of negotiation to avoid compatibility issues // with endpoints like ContainerStatPath that may not be available in all API versions - cli, err = client.NewClientWithOpts(client.FromEnv, client.WithVersion("1.41")) + cli, err = client.NewClientWithOpts(client.FromEnv, client.WithVersion(dockerAPIVersion)) if err != nil { return }