diff --git a/examples/podman.yaml b/examples/podman.yaml index aeb679bbc2a..539c937aa53 100644 --- a/examples/podman.yaml +++ b/examples/podman.yaml @@ -56,4 +56,4 @@ portForwards: message: | To run `podman` on the host (assumes podman-remote is installed): $ export CONTAINER_HOST=unix://{{.Dir}}/sock/podman.sock - $ podman --remote ... + $ podman{{if eq .HostOS "linux"}}-remote{{end}} ... diff --git a/pkg/limayaml/default.yaml b/pkg/limayaml/default.yaml index c1dc0ba73d5..0eef97cdb0d 100644 --- a/pkg/limayaml/default.yaml +++ b/pkg/limayaml/default.yaml @@ -199,6 +199,7 @@ networks: # Message. Information to be shown to the user, given as a Go template for the instance. # The same template variables as for listing instances can be used, for example {{.Dir}}. # You can view the complete list of variables using `limactl list --list-fields` command. +# It also includes {{.HostOS}} and {{.HostArch}} vars, for the runtime GOOS and GOARCH. # message: | # This will be shown to the user. diff --git a/pkg/store/instance.go b/pkg/store/instance.go index 274d3c23a37..57c875768ef 100644 --- a/pkg/store/instance.go +++ b/pkg/store/instance.go @@ -6,6 +6,7 @@ import ( "fmt" "os" "path/filepath" + "runtime" "strconv" "strings" "syscall" @@ -170,6 +171,8 @@ func ReadPIDFile(path string) (int, error) { type FormatData struct { Instance + HostOS string + HostArch string LimaHome string IdentityFile string } @@ -177,6 +180,10 @@ type FormatData struct { func AddGlobalFields(inst *Instance) (FormatData, error) { var data FormatData data.Instance = *inst + // Add HostOS + data.HostOS = runtime.GOOS + // Add HostArch + data.HostArch = runtime.GOARCH // Add IdentityFile configDir, err := dirnames.LimaConfigDir() if err != nil {