Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions src/cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,14 @@ func createContainer(container, image, release, authFile string, showCommandToEn
"--volume", runtimeDirectoryMountArg,
}...)

if podman.CheckVersion("3.2.0") {
if runtime, _ := podman.GetRuntimeName(); runtime == "crun" {
createArgs = append(createArgs, []string{
"--group-add", "keep-groups",
}...)
}
}

createArgs = append(createArgs, avahiSocketMount...)
createArgs = append(createArgs, kcmSocketMount...)
createArgs = append(createArgs, mediaMount...)
Expand Down
25 changes: 25 additions & 0 deletions src/pkg/podman/podman.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,31 @@ func GetImages(args ...string) ([]Image, error) {
return images, nil
}

// GetRuntimeName returns OCI Runtime of Podman in a string
func GetRuntimeName() (string, error) {
var stdout bytes.Buffer

logLevelString := LogLevel.String()
args := []string{"--log-level", logLevelString, "info", "--format", "json"}

if err := shell.Run("podman", nil, &stdout, nil, args...); err != nil {
return "", err
}

var podmanInfo struct {
Host struct {
OCIRuntime struct {
Name string `json:"name"`
} `json:"ociRuntime"`
} `json:"host"`
}
if err := json.Unmarshal(stdout.Bytes(), &podmanInfo); err != nil {
return "", err
}

return podmanInfo.Host.OCIRuntime.Name, nil
}

// GetVersion returns version of Podman in a string
func GetVersion() (string, error) {
if podmanVersion != "" {
Expand Down