Skip to content

Commit d5960ad

Browse files
thaJeztahdhui
authored andcommitted
Docker: restore "from env" behavior, and perform API version negotiation (#270)
* NewDockerContainer: restore "from env" behavior commit c31948c replaced the deprecated `dockerclient.NewEnvClient` with `dockerclient.NewClientWithOpts`, but did not add the `FromEnv` option to keep the old behavior. Signed-off-by: Sebastiaan van Stijn <[email protected]> * NewDockerContainer: use API version negotiation This helps in situations where the daemon is older than the API client. API version negotiation checks the maximum supported API version by the daemon, and downgrades to that API version if needed. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent d068374 commit d5960ad

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/cznic/ql v1.2.0
1111
github.com/denisenkom/go-mssqldb v0.0.0-20190515213511-eb9f6a1743f3
1212
github.com/dhui/dktest v0.3.0
13-
github.com/docker/docker v0.7.3-0.20190108045446-77df18c24acf
13+
github.com/docker/docker v0.7.3-0.20190817195342-4760db040282
1414
github.com/fsouza/fake-gcs-server v1.7.0
1515
github.com/go-sql-driver/mysql v1.4.1
1616
github.com/gocql/gocql v0.0.0-20190301043612-f6df8288f9b4

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ github.com/docker/distribution v2.7.0+incompatible/go.mod h1:J2gT2udsDAN96Uj4Kfc
5858
github.com/docker/docker v0.7.3-0.20190103212154-2b7e084dc98b/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
5959
github.com/docker/docker v0.7.3-0.20190108045446-77df18c24acf h1:2v/98rHzs3v6X0AHtoCH9u+e56SdnpogB1Z2fFe1KqQ=
6060
github.com/docker/docker v0.7.3-0.20190108045446-77df18c24acf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
61+
github.com/docker/docker v0.7.3-0.20190817195342-4760db040282 h1:mzrx39dGtGq0VEnTHjnakmczd4uFbhx2cZU3BJDsLdc=
62+
github.com/docker/docker v0.7.3-0.20190817195342-4760db040282/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
6163
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
6264
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
6365
github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk=

testing/docker.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ import (
2323
)
2424

2525
func NewDockerContainer(t testing.TB, image string, env []string, cmd []string) (*DockerContainer, error) {
26-
c, err := dockerclient.NewClientWithOpts()
26+
c, err := dockerclient.NewClientWithOpts(
27+
dockerclient.FromEnv,
28+
dockerclient.WithAPIVersionNegotiation(),
29+
)
2730
if err != nil {
2831
return nil, err
2932
}

0 commit comments

Comments
 (0)