MCPcopy Create free account
hub / github.com/containerd/nerdctl / ValidateDockerCompat

Function ValidateDockerCompat

pkg/identifiers/validate.go:36–46  ·  view source on GitHub ↗

ValidateDockerCompat implements docker compatible identifier validation. The containerd implementation allows single character identifiers, while the Docker compatible implementation requires at least 2 characters for identifiers. The containerd implementation enforces a maximum length constraint of

(s string)

Source from the content-addressed store, hash-verified

34// The containerd implementation enforces a maximum length constraint of 76 characters,
35// while the Docker compatible implementation omits the length check entirely.
36func ValidateDockerCompat(s string) error {
37 if len(s) == 0 {
38 return fmt.Errorf("identifier must not be empty %w", errdefs.ErrInvalidArgument)
39 }
40
41 if !AllowedIdentifierPattern.MatchString(s) {
42 return fmt.Errorf("identifier %q must match pattern %q: %w", s, AllowedIdentfierChars, errdefs.ErrInvalidArgument)
43 }
44
45 return nil
46}

Callers 13

NewFunction · 0.92
parseBuildConfigFunction · 0.92
isNamedVolumeFunction · 0.92
ExistsMethod · 0.92
GetMethod · 0.92
CreateWithoutLockMethod · 0.92
CreateMethod · 0.92
RemoveMethod · 0.92
AcquireMethod · 0.92
ReleaseMethod · 0.92
RenameMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…