mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 18:11:35 +00:00
Don't use deprecated api
Signed-off-by: David Gageot <david.gageot@docker.com>
This commit is contained in:
parent
d589bd18f1
commit
4df610741d
@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/containerd/containerd/reference"
|
"github.com/containerd/containerd/reference"
|
||||||
dockertypes "github.com/docker/docker/api/types"
|
dockertypes "github.com/docker/docker/api/types"
|
||||||
@ -15,13 +14,15 @@ import (
|
|||||||
|
|
||||||
// Client get a docker client.
|
// Client get a docker client.
|
||||||
func Client() (*client.Client, error) {
|
func Client() (*client.Client, error) {
|
||||||
// for maximum compatibility as we use nothing new
|
options := []client.Opt{
|
||||||
// 1.30 corresponds to Docker 17.06, supported until 2020.
|
// for maximum compatibility as we use nothing new
|
||||||
err := os.Setenv("DOCKER_API_VERSION", "1.30")
|
// 1.30 corresponds to Docker 17.06, supported until 2020.
|
||||||
if err != nil {
|
client.WithVersion("1.30"),
|
||||||
return nil, err
|
client.WithTLSClientConfigFromEnv(),
|
||||||
|
client.WithHostFromEnv(),
|
||||||
}
|
}
|
||||||
return client.NewEnvClient()
|
|
||||||
|
return client.NewClientWithOpts(options...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// HasImage check if the provided ref is available in the docker cache.
|
// HasImage check if the provided ref is available in the docker cache.
|
||||||
|
Loading…
Reference in New Issue
Block a user