Skip to content

Commit

Permalink
Only show the podman --remote flag on linux
Browse files Browse the repository at this point in the history
On macOS and Windows, "podman-remote" is called "podman".

On Linux, make sure that it calls the $CONTAINER_HOST...

Signed-off-by: Anders F Björklund <[email protected]>
  • Loading branch information
afbjorklund committed Dec 13, 2021
1 parent b6fdde0 commit 88029fe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/podman.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}} ...
1 change: 1 addition & 0 deletions pkg/limayaml/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
7 changes: 7 additions & 0 deletions pkg/store/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"os"
"path/filepath"
"runtime"
"strconv"
"strings"
"syscall"
Expand Down Expand Up @@ -170,13 +171,19 @@ func ReadPIDFile(path string) (int, error) {

type FormatData struct {
Instance
HostOS string
HostArch string
LimaHome string
IdentityFile string
}

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 {
Expand Down

0 comments on commit 88029fe

Please sign in to comment.