mirror of
https://github.com/containers/podman.git
synced 2025-05-29 14:06:29 +08:00
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
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user