MCPcopy
hub / github.com/moby/moby / rejectLegacyCapabilities

Function rejectLegacyCapabilities

daemon/server/router/container/container_routes.go:835–840  ·  view source on GitHub ↗

rejectLegacyCapabilities returns an error if the deprecated HostConfig.Capabilities field is present in a request for API version 1.40. The Capabilities field was added in API 1.40 (Docker 19.03) as a way to specify the exact set of kernel capabilities for a container, overriding the CapAdd/CapDrop

(capabilities []string, version string)

Source from the content-addressed store, hash-verified

833// return an explicit error rather than silently ignoring the field when it is
834// expected to be supported.
835func rejectLegacyCapabilities(capabilities []string, version string) error {
836 if len(capabilities) > 0 && versions.Equal(version, "1.40") {
837 return errLegacyCapabilities
838 }
839 return nil
840}
841
842// handleMACAddressBC takes care of backward-compatibility for the container-wide MAC address by mutating the
843// networkingConfig to set the endpoint-specific MACAddress field introduced in API v1.44. It returns a warning message

Callers 2

postContainersCreateMethod · 0.85

Calls 1

EqualFunction · 0.92

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…