aboutsummaryrefslogtreecommitdiff
path: root/libpod/runtime.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-01-30 09:31:16 -0600
committerAtomic Bot <atomic-devel@projectatomic.io>2018-01-31 15:27:14 +0000
commitecb74aa40641cd322112401a593eaf26458e9d24 (patch)
tree5864facd587661a52d5e1be34327e99f072a4c32 /libpod/runtime.go
parentb3f8eef8d8a83b7acdf7e60a2be72f891b3c83e2 (diff)
downloadpodman-ecb74aa40641cd322112401a593eaf26458e9d24.tar.gz
podman-ecb74aa40641cd322112401a593eaf26458e9d24.tar.bz2
podman-ecb74aa40641cd322112401a593eaf26458e9d24.zip
libpod/runtime.go: runtime path
Ubuntu installs runc to /usr/sbin/runc so we now account for that. Also, added small check when creating a new runtime that if we cannot find the runc binary, we bail out. Signed-off-by: baude <bbaude@redhat.com> Closes: #276 Approved by: baude
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r--libpod/runtime.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go
index 20ae2c6fe..afde03904 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -77,7 +77,7 @@ var (
StorageConfig: storage.StoreOptions{},
ImageDefaultTransport: DefaultTransport,
StateType: SQLiteStateStore,
- RuntimePath: "/usr/bin/runc",
+ RuntimePath: findRuncPath(),
ConmonPath: findConmonPath(),
ConmonEnvVars: []string{
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
@@ -101,6 +101,15 @@ func findConmonPath() string {
return path
}
+func findRuncPath() string {
+ path := "/usr/bin/runc"
+ _, err := os.Stat(path)
+ if err != nil {
+ path = "/usr/sbin/runc"
+ }
+ return path
+}
+
// NewRuntime creates a new container runtime
// Options can be passed to override the default configuration for the runtime
func NewRuntime(options ...RuntimeOption) (runtime *Runtime, err error) {
@@ -117,6 +126,11 @@ func NewRuntime(options ...RuntimeOption) (runtime *Runtime, err error) {
}
}
+ // Check for the existence of the runc binary
+ if _, err := os.Stat(runtime.config.RuntimePath); err != nil {
+ return nil, errors.Errorf("unable to find runc binary %s", runtime.config.RuntimePath)
+ }
+
// Set up containers/storage
store, err := storage.GetStore(runtime.config.StorageConfig)
if err != nil {