mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Add const for "unconfined" and default seccomp profiles
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/containerd/containerd/containers"
|
||||
coci "github.com/containerd/containerd/oci"
|
||||
"github.com/docker/docker/container"
|
||||
dconfig "github.com/docker/docker/daemon/config"
|
||||
"github.com/docker/docker/profiles/seccomp"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
@@ -18,7 +19,7 @@ const supportsSeccomp = true
|
||||
// WithSeccomp sets the seccomp profile
|
||||
func WithSeccomp(daemon *Daemon, c *container.Container) coci.SpecOpts {
|
||||
return func(ctx context.Context, _ coci.Client, _ *containers.Container, s *coci.Spec) error {
|
||||
if c.SeccompProfile == "unconfined" {
|
||||
if c.SeccompProfile == dconfig.SeccompProfileUnconfined {
|
||||
return nil
|
||||
}
|
||||
if c.HostConfig.Privileged {
|
||||
@@ -29,7 +30,7 @@ func WithSeccomp(daemon *Daemon, c *container.Container) coci.SpecOpts {
|
||||
return fmt.Errorf("seccomp is not enabled in your kernel, cannot run a custom seccomp profile")
|
||||
}
|
||||
logrus.Warn("seccomp is not enabled in your kernel, running container without default profile")
|
||||
c.SeccompProfile = "unconfined"
|
||||
c.SeccompProfile = dconfig.SeccompProfileUnconfined
|
||||
return nil
|
||||
}
|
||||
var err error
|
||||
|
||||
Reference in New Issue
Block a user