Files
nomad/drivers/shared/capabilities/defaults_windows.go
Piotr Kazmierczak f22ce921cd docker: adjust capabilities on Windows (#23599)
Adjusts Docker capabilities per OS, and checks for runtime on Windows.

---------

Co-authored-by: Tim Gross <tgross@hashicorp.com>
2024-07-17 09:01:45 +02:00

34 lines
815 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
//go:build windows
package capabilities
import (
"strings"
docker "github.com/fsouza/go-dockerclient"
)
// DockerDefaults is a list of Windows capabilities enabled by Docker by default
// and is used to compute the set of capabilities to add/drop given docker driver
// configuration.
//
// Doing this on windows is somewhat tricky, because capabilities differ by
// runtime, so we have to perform some extra checks.
func DockerDefaults(ver *docker.Env) *Set {
defaults := NomadDefaults()
// Docker CE doesn't include NET_RAW on Windows, Mirantis (aka Docker EE) does
var platform string
if ver != nil {
platform = ver.Get("Platform")
}
if strings.Contains(platform, "Mirantis") {
defaults.Add("NET_RAW")
}
return defaults
}