diff options
author | Matthew Heon <matthew.heon@pm.me> | 2020-07-28 15:59:58 -0400 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2020-10-20 09:20:33 -0400 |
commit | f9655d92d660bad46a992831605960767fedc44a (patch) | |
tree | 5656073b4cd775ae00e9c01e0ac3757ab5d9e23a /libpod/runtime.go | |
parent | 35b4cb196545eee3b072083e716ad4588e0bb486 (diff) | |
download | podman-f9655d92d660bad46a992831605960767fedc44a.tar.gz podman-f9655d92d660bad46a992831605960767fedc44a.tar.bz2 podman-f9655d92d660bad46a992831605960767fedc44a.zip |
When given OCI runtime by path, use path as name
Say I start a container with the flag
`--runtime /usr/local/sbin/crun`. I then stop the container, and
restart it without the flag. We previously stored the runtime in
use by a container only by basename when given a path, so the
container only knows that it's using the `crun` OCI runtime - and
on being restarted without the flag, it will use the system crun,
not my special crun build.
Using the full path as the name in these cases ensures we will
still use the correct runtime, even on subsequent runs of Podman.
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r-- | libpod/runtime.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go index 7da8b181f..6d5ea9c34 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -383,14 +383,12 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) { // If the string starts with / it's a path to a runtime // executable. if strings.HasPrefix(runtime.config.Engine.OCIRuntime, "/") { - name := filepath.Base(runtime.config.Engine.OCIRuntime) - - ociRuntime, err := newConmonOCIRuntime(name, []string{runtime.config.Engine.OCIRuntime}, runtime.conmonPath, runtime.runtimeFlags, runtime.config) + ociRuntime, err := newConmonOCIRuntime(runtime.config.Engine.OCIRuntime, []string{runtime.config.Engine.OCIRuntime}, runtime.conmonPath, runtime.runtimeFlags, runtime.config) if err != nil { return err } - runtime.ociRuntimes[name] = ociRuntime + runtime.ociRuntimes[runtime.config.Engine.OCIRuntime] = ociRuntime runtime.defaultOCIRuntime = ociRuntime } else { ociRuntime, ok := runtime.ociRuntimes[runtime.config.Engine.OCIRuntime] |