You’re trying to use client.NewClientWithOpts
from github.com/docker/docker/client
module and you can’t find it? Getting client.NewClientWithOpts not declared by package client
?
I’ve been there, and fix is relatively easy:
- First add this line to your
go.mod
file:// force go mod to pull proper package for docker replace github.com/docker/docker => github.com/docker/engine v0.0.0-20191113042239-ea84732a7725
This tells go modules to replace references to
docker/docker
withdocker/engine
- where the module is really stored. - Make sure that your
go.mod
file references proper packages. In my case it was replacing gopkg.in references with the ones to github:github.com/docker/docker v1.13.1 github.com/docker/engine-api v0.4.0
Voilà - go
resolves proper docker api client package now.