func (c *container) selectRuntime() error {
	r, err := c.runtimeConfig.New()
	if err != nil {
		return fmt.Errorf("selecting container runtime: %w", err)
	}
	c.runtime = r
	return nil
}
selectRuntime returns container runtime configured for container.

It returns error if container runtime configuration is invalid.
package container
import (
	"fmt"
	"os"
	"github.com/flexkube/libflexkube/pkg/container/runtime"
	"github.com/flexkube/libflexkube/pkg/container/runtime/docker"
	"github.com/flexkube/libflexkube/pkg/container/types"
)
type Interface interface {
	Create() (InstanceInterface, error)
	FromStatus() (InstanceInterface, error)
	UpdateStatus() error
	Start() error
	Stop() error
	Delete() error
	Status() *types.ContainerStatus
	Config() types.ContainerConfig
	RuntimeConfig() runtime.Config
	Runtime() runtime.Runtime
	SetRuntime(runtime.Runtime)
	SetStatus(types.ContainerStatus)
}
type InstanceInterface interface {
	Status() (types.ContainerStatus, error)
	Read(srcPath []string) ([]*types.File, error)
	Copy(files []*types.File) error
	Stat(paths []string) (map[string]os.FileMode, error)
	Start() error
	Stop() error
	Delete() error
}
type Container struct {
	Config types.ContainerConfig `json:"config"`
	Status *types.ContainerStatus `json:"status,omitempty"`
	Runtime RuntimeConfig `json:"runtime,omitempty"`
}
type RuntimeConfig struct {
	Docker *docker.Config `json:"docker,omitempty"`
}
type container struct {
	base
}
type containerInstance struct {
	base
}
type base struct {
	config types.ContainerConfig
	runtime       runtime.Runtime
	runtimeConfig runtime.Config
	status types.ContainerStatus
}
func (c *Container) New() (Interface, error) {
	if err := c.Validate(); err != nil {
		return nil, fmt.Errorf("container configuration validation failed: %w", err)
	}
	nc := &container{
		base{
			config:        c.Config,
			runtimeConfig: c.Runtime.Docker,
		},
	}
	if c.Status != nil {
		nc.base.status = *c.Status
	}
	if err := nc.selectRuntime(); err != nil {
		return nil, fmt.Errorf("determining container runtime: %w", err)
	}
	return nc, nil
}
func (c *Container) Validate() error {
	if c.Config.Name == "" {
		return fmt.Errorf("name must be set")
	}
	if c.Config.Image == "" {
		return fmt.Errorf("image must be set")
	}
	if c.Runtime.Docker == nil {
		return fmt.Errorf("docker runtime must be set")
	}
	return nil
}