mirror of
https://github.com/mudler/luet.git
synced 2025-09-07 18:20:19 +00:00
default transport allows to pick up proxy vars from environment variables (#309)
This commit is contained in:
@@ -18,6 +18,7 @@ package docker
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/containerd/containerd/images"
|
"github.com/containerd/containerd/images"
|
||||||
@@ -32,8 +33,8 @@ import (
|
|||||||
"github.com/docker/docker/registry"
|
"github.com/docker/docker/registry"
|
||||||
"github.com/google/go-containerregistry/pkg/authn"
|
"github.com/google/go-containerregistry/pkg/authn"
|
||||||
"github.com/google/go-containerregistry/pkg/name"
|
"github.com/google/go-containerregistry/pkg/name"
|
||||||
"github.com/google/go-containerregistry/pkg/v1/remote"
|
|
||||||
"github.com/google/go-containerregistry/pkg/v1/daemon"
|
"github.com/google/go-containerregistry/pkg/v1/daemon"
|
||||||
|
"github.com/google/go-containerregistry/pkg/v1/remote"
|
||||||
"github.com/mudler/luet/pkg/api/core/bus"
|
"github.com/mudler/luet/pkg/api/core/bus"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
specs "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
@@ -148,7 +149,7 @@ func DownloadAndExtractDockerImage(ctx luettypes.Context, image, dest string, au
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
img, err := remote.Image(ref, remote.WithAuth(staticAuth{auth}))
|
img, err := remote.Image(ref, remote.WithAuth(staticAuth{auth}), remote.WithTransport(http.DefaultTransport))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -194,7 +195,7 @@ func DownloadAndExtractDockerImage(ctx luettypes.Context, image, dest string, au
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExtractDockerImage(ctx luettypes.Context, local, dest string)(*images.Image, error) {
|
func ExtractDockerImage(ctx luettypes.Context, local, dest string) (*images.Image, error) {
|
||||||
if !fileHelper.Exists(dest) {
|
if !fileHelper.Exists(dest) {
|
||||||
if err := os.MkdirAll(dest, os.ModePerm); err != nil {
|
if err := os.MkdirAll(dest, os.ModePerm); err != nil {
|
||||||
return nil, errors.Wrapf(err, "cannot create destination directory")
|
return nil, errors.Wrapf(err, "cannot create destination directory")
|
||||||
|
Reference in New Issue
Block a user