"Install the SDKs - Go SDK" command fails
Is this a docs issue?
- [x] My issue is about the documentation content or website
Type of issue
Other
Description
I am trying to create a Go client using Docker Go SDK.
From Develop with Docker Engine SDKs page, I run the following command.
$ go get github.com/docker/docker/client
However, the command fails with following output.
go: downloading github.com/docker/docker/client v0.0.0-20250721234113-596e088bd057
go: downloading github.com/docker/docker v28.3.2+incompatible
go: github.com/docker/docker/client@upgrade (v0.0.0-20250721234113-596e088bd057) requires github.com/docker/docker/[email protected]: parsing go.mod:
module declares its path as: github.com/moby/moby/client
but was required as: github.com/docker/docker/client
I am running go1.24.5 windows/amd64 Go version.
I am not sure if this is the place to ask about this issue, since I see moby/moby/client from the log. I can't find any references to the project moby from the documentation.
Location
https://docs.docker.com/reference/api/engine/sdk/
Suggestion
No response
Apparently I have to add the following lines to the go.mod file.
replace github.com/docker/docker => github.com/moby/moby latest
And then run go mod tidy
I am not familiar with Go projects, but at least I have fixed the issue.
Thanks for reporting; we are currently in process of migrating the SDK to use go modules, which includes a rename and splitting up of the code to separate modules for the API, client, and daemon; see https://github.com/moby/moby/issues/49873
I would (currently) NOT use the replace rule because the new API module is not stable yet, and packages will still be moved.
Instead specify the latest release to be used; in your go.mod, e.g.; similar to how docker compose does; https://github.com/docker/compose/blob/v2.38.2/go.mod#L18-L20
require (
github.com/docker/docker v28.3.1+incompatible
}
Some changes will be needed after the transition to go modules is completed though, after which these modules will be named github.com/moby/moby