Im trying to install the official go docker client by importing
"github.com/docker/docker/client"
But i get the following error
cannot load github.com/docker/distribution/reference: cannot find module providing package github.com/docker/distribution/reference
My go version is 1.12 and my project is outside $GOPATH/src. My go.mod file looks like this.
module app
go 1.12
require (
github.com/Microsoft/go-winio v0.4.14 // indirect
github.com/docker/docker v1.13.1
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 // indirect
)
Based on docker documentation , it says that you have to execute go get github.com/docker/docker/client
command to download it. Once library is retrieved it should compile.
I remember that I had similar problems as you 1.5-2 monthes ago.
My observations :
I did not found answers for "what actually describes official documentation?" or "where actually docker API repo?"
I gave up on attempts to solve in "official way" and found that more practical to use "unofficial"
"Unofficial way" :
docker-ce
repo. docker/client
usage I found here: components/engine/integration/internal/container/exec.go (note that it resides in internal
and is impossible to be used as package) Maybe it's "incorrect" solution but it worked for me.
I suppose it could be more practical for you to not rely on docker documentation too.
Good luck!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.