diff --git a/pkg/server/sandbox_run.go b/pkg/server/sandbox_run.go index 6598f61c0..8b514caf1 100644 --- a/pkg/server/sandbox_run.go +++ b/pkg/server/sandbox_run.go @@ -89,6 +89,13 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox if err != nil { return nil, errors.Wrapf(err, "failed to get sandbox image %q", c.config.SandboxImage) } + + ociRuntime, err := c.getSandboxRuntime(config, r.GetRuntimeHandler()) + if err != nil { + return nil, errors.Wrap(err, "failed to get sandbox runtime") + } + logrus.Debugf("Use OCI %+v for sandbox %q", ociRuntime, id) + securityContext := config.GetLinux().GetSecurityContext() //Create Network Namespace if it is not in host network hostNet := securityContext.GetNamespaceOptions().GetNetwork() == runtime.NamespaceMode_NODE @@ -132,12 +139,6 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox }() } - ociRuntime, err := c.getSandboxRuntime(config, r.GetRuntimeHandler()) - if err != nil { - return nil, errors.Wrap(err, "failed to get sandbox runtime") - } - logrus.Debugf("Use OCI %+v for sandbox %q", ociRuntime, id) - // Create sandbox container. spec, err := c.generateSandboxContainerSpec(id, config, &image.ImageSpec.Config, sandbox.NetNSPath) if err != nil {