summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2019-11-07 08:17:46 +0000
committerValentin Rothberg <rothberg@redhat.com>2019-11-07 13:55:41 +0000
commit709ad91035ecaff05159065126b207dd0f482b55 (patch)
tree79222b21ed4434da32b7c055e6143cd6dc19ea5f
parent2e2d82ce767895e80da0d6cf5e6d391901687deb (diff)
downloadpodman-709ad91035ecaff05159065126b207dd0f482b55.tar.gz
podman-709ad91035ecaff05159065126b207dd0f482b55.tar.bz2
podman-709ad91035ecaff05159065126b207dd0f482b55.zip
libpod/config: default: use `crun` on Cgroups v2
When running on a node with Cgroups v2, default to using `crun` instead of `runc`. Note that this only impacts the hard-coded default config. No user config will be over-written. Fixes: #4463 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
-rw-r--r--libpod.conf9
-rw-r--r--libpod/config/default.go17
2 files changed, 23 insertions, 3 deletions
diff --git a/libpod.conf b/libpod.conf
index 47f66ecc1..ef7c101a6 100644
--- a/libpod.conf
+++ b/libpod.conf
@@ -142,8 +142,13 @@ runc = [
]
crun = [
- "/usr/bin/crun",
- "/usr/local/bin/crun",
+ "/usr/bin/crun",
+ "/usr/sbin/crun",
+ "/usr/local/bin/crun",
+ "/usr/local/sbin/crun",
+ "/sbin/crun",
+ "/bin/crun",
+ "/run/current-system/sw/bin/crun",
]
# The [runtimes] table MUST be the last thing in this file.
diff --git a/libpod/config/default.go b/libpod/config/default.go
index 17574c059..5decaeab7 100644
--- a/libpod/config/default.go
+++ b/libpod/config/default.go
@@ -6,6 +6,7 @@ import (
"github.com/containers/libpod/libpod/define"
"github.com/containers/libpod/libpod/events"
+ "github.com/containers/libpod/pkg/cgroups"
"github.com/containers/libpod/pkg/rootless"
"github.com/containers/libpod/pkg/util"
"github.com/containers/storage"
@@ -47,6 +48,12 @@ func defaultConfigFromMemory() (*Config, error) {
c.ImageDefaultTransport = _defaultTransport
c.StateType = define.BoltDBStateStore
c.OCIRuntime = "runc"
+
+ // If we're running on cgroups v2, default to using crun.
+ if onCgroupsv2, _ := cgroups.IsCgroup2UnifiedMode(); onCgroupsv2 {
+ c.OCIRuntime = "crun"
+ }
+
c.OCIRuntimes = map[string][]string{
"runc": {
"/usr/bin/runc",
@@ -58,7 +65,15 @@ func defaultConfigFromMemory() (*Config, error) {
"/usr/lib/cri-o-runc/sbin/runc",
"/run/current-system/sw/bin/runc",
},
- // TODO - should we add "crun" defaults here as well?
+ "crun": {
+ "/usr/bin/crun",
+ "/usr/sbin/crun",
+ "/usr/local/bin/crun",
+ "/usr/local/sbin/crun",
+ "/sbin/crun",
+ "/bin/crun",
+ "/run/current-system/sw/bin/crun",
+ },
}
c.ConmonPath = []string{
"/usr/libexec/podman/conmon",