mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 17:49:10 +00:00
Add support for runtime containerd namespace configuration
Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
parent
99fd71dc7f
commit
4b9ffadb2e
@ -23,6 +23,7 @@ type Runtime struct {
|
||||
Mkdir []string `yaml:"mkdir" json:"mkdir,omitempty"`
|
||||
Interfaces []Interface `yaml:"interfaces" json:"interfaces,omitempty"`
|
||||
BindNS Namespaces `yaml:"bindNS" json:"bindNS,omitempty"`
|
||||
Namespace string `yaml:"namespace,omitempty" json:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
// Namespaces is the type for configuring paths to bind namespaces
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/cio"
|
||||
"github.com/containerd/containerd/namespaces"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
@ -113,6 +114,10 @@ func start(ctx context.Context, service, sock, basePath, dumpSpec string) (strin
|
||||
|
||||
}
|
||||
|
||||
if runtimeConfig.Namespace != "" {
|
||||
ctx = namespaces.WithNamespace(ctx, runtimeConfig.Namespace)
|
||||
}
|
||||
|
||||
ctr, err := client.NewContainer(ctx, service, containerd.WithSpec(spec))
|
||||
if err != nil {
|
||||
return "", 0, "failed to create container", err
|
||||
|
Loading…
Reference in New Issue
Block a user