From 854d98a481c967e41c9e6bb2e9f307d64c9b5eb8 Mon Sep 17 00:00:00 2001 From: Tiger Kaovilai Date: Wed, 7 Aug 2024 17:22:23 -0400 Subject: [PATCH] Only use podman if CLI can execute. Use docker if non-Linux podman has no connection to Linux system. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Solves ``` ❯ make test Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM Error: unable to connect to Podman socket: failed to read identity "/Users/tiger/.local/share/containers/podman/machine/machine": open /Users/tiger/.local/share/containers/podman/machine/machine: no such file or directory /opt/homebrew/bin/docker run --rm -e LDFLAGS=" -X main.GitCommit=bbdd974+CHANGES -X main.GitDescribe=v4 -w -s" -e GITHUB_TOKEN="" -v /Users/tiger/git/yq-k8s/vendor:/go/src -v /Users/tiger/git/yq-k8s:/yq/src/github.com/mikefarah/yq -w /yq/src/github.com/mikefarah/yq yq_dev go mod vendor Error: podman-machine-default: VM already exists ``` Signed-off-by: Tiger Kaovilai --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 42c11fb2cd5..e50cdd4870d 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ MAKEFLAGS += --warn-undefined-variables SHELL := /bin/bash .SHELLFLAGS := -o pipefail -euc .DEFAULT_GOAL := install -ENGINE := $(shell { command -v podman || command -v docker; } 2>/dev/null) +ENGINE := $(shell { (podman version > /dev/null 2>&1 && command -v podman) || command -v docker; } 2>/dev/null) include Makefile.variables