mirror of
https://github.com/containers/podman.git
synced 2025-05-21 00:56:36 +08:00
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>
This commit is contained in:

committed by
Matthew Heon

parent
35b4cb1965
commit
f9655d92d6
@ -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]
|
||||
|
Reference in New Issue
Block a user