dive/dive/image/docker/cli.go
Alex Goodman d5e8a92968
Rework CI validation workflow and makefile (#460)
* rework CI validation workflow and makefile

* enable push

* fix job names

* fix license check

* fix snapshot builds

* fix acceptance tests

* fix linting

* disable pull request event

* rework windows runner caching

* disable release pipeline and add issue templates
2023-07-06 22:01:46 -04:00

33 lines
635 B
Go

package docker
import (
"fmt"
"os"
"os/exec"
"github.com/wagoodman/dive/utils"
)
// runDockerCmd runs a given Docker command in the current tty
func runDockerCmd(cmdStr string, args ...string) error {
if !isDockerClientBinaryAvailable() {
return fmt.Errorf("cannot find docker client executable")
}
allArgs := utils.CleanArgs(append([]string{cmdStr}, args...))
cmd := exec.Command("docker", allArgs...)
cmd.Env = os.Environ()
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Stdin = os.Stdin
return cmd.Run()
}
func isDockerClientBinaryAvailable() bool {
_, err := exec.LookPath("docker")
return err == nil
}