mirror of
https://gitea.com/gitea/runner.git
synced 2026-11-12 02:44:10 +00:00
extract the docker NewClientWithOpts, and add connectionhelper for DOCKER_HOST set to ssh://remote (#207)
Signed-off-by: Sven Dowideit <[email protected]> Co-authored-by: Casey Lee <[email protected]>
This commit is contained in:
1 parent
ef9fab9fad
commit
6196436f70
7 files changed
+42
-15
No files matched your search
@@ -5,17 +5,15 @@ import (
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/client"
|
||||
)
|
||||
|
||||
// ImageExistsLocally returns a boolean indicating if an image with the
|
||||
// requested name (and tag) exist in the local docker image store
|
||||
func ImageExistsLocally(ctx context.Context, imageName string) (bool, error) {
|
||||
cli, err := client.NewClientWithOpts(client.FromEnv)
|
||||
cli, err := GetDockerClient(ctx)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
cli.NegotiateAPIVersion(ctx)
|
||||
|
||||
filters := filters.NewArgs()
|
||||
filters.Add("reference", imageName)
|
||||
|
||||
Reference in new issue
Block a user