Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The podman cp command is not in podman-remote #8060

Merged
merged 1 commit into from
May 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions pkg/minikube/command/kic_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import (
"os"
"os/exec"
"path"
"runtime"
"strconv"
"strings"
"time"

"github.com/golang/glog"
Expand Down Expand Up @@ -202,8 +204,27 @@ func (k *kicRunner) chmod(dst string, perm string) error {

// Podman cp command doesn't match docker and doesn't have -a
func copyToPodman(src string, dest string) error {
if out, err := oci.PrefixCmd(exec.Command(oci.Podman, "cp", src, dest)).CombinedOutput(); err != nil {
return errors.Wrapf(err, "podman copy %s into %s, output: %s", src, dest, string(out))
if runtime.GOOS == "linux" {
cmd := oci.PrefixCmd(exec.Command(oci.Podman, "cp", src, dest))
glog.Infof("Run: %v", cmd)
if out, err := cmd.CombinedOutput(); err != nil {
return errors.Wrapf(err, "podman copy %s into %s, output: %s", src, dest, string(out))
}
} else {
file, err := os.Open(src)
if err != nil {
return err
}
defer file.Close()
parts := strings.Split(dest, ":")
container := parts[0]
path := parts[1]
cmd := exec.Command(oci.Podman, "exec", "-i", container, "tee", path)
cmd.Stdin = file
glog.Infof("Run: %v", cmd)
if err := cmd.Run(); err != nil {
return errors.Wrapf(err, "podman copy %s into %s", src, dest)
}
}
return nil
}
Expand Down