unpack local image file with prefix file:// (#318)

Co-authored-by: Ettore Di Giacinto <mudler@users.noreply.github.com>
This commit is contained in:
Santhosh
2023-02-02 17:18:09 +05:30
committed by GitHub
parent 5ee1ff6d5a
commit d48006af8a
3 changed files with 29 additions and 6 deletions

View File

@@ -20,6 +20,7 @@ import (
"os"
"path/filepath"
"runtime"
"strings"
"github.com/docker/docker/api/types"
"github.com/docker/go-units"
@@ -34,6 +35,10 @@ import (
"github.com/spf13/cobra"
)
const (
filePrefix = "file://"
)
func pack(ctx *context.Context, p, dst, imageName, arch, OS string) error {
tempimage, err := ctx.TempFile("tempimage")
@@ -126,7 +131,7 @@ func NewUnpackCommand() *cobra.Command {
RegistryToken: registryToken,
}
if !local {
if !local && !strings.HasPrefix(image, filePrefix) {
info, err := docker.DownloadAndExtractDockerImage(util.DefaultContext, image, destination, auth, verify)
if err != nil {
util.DefaultContext.Error(err.Error())