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

Method SuggestContainerName

pkg/referenceutil/referenceutil.go:86–94  ·  view source on GitHub ↗
(suffix string)

Source from the content-addressed store, hash-verified

84}
85
86func (ir *ImageReference) SuggestContainerName(suffix string) string {
87 name := "untitled"
88 if ir.Protocol != "" && ir.Domain == "" {
89 name = string(ir.Protocol) + "-" + ir.String()[:shortIDLength]
90 } else if ir.Path != "" {
91 name = path.Base(ir.Path)
92 }
93 return name + "-" + suffix[:5]
94}
95
96func Parse(rawRef string) (*ImageReference, error) {
97 ir := &ImageReference{}

Callers 2

CreateFunction · 0.80
TestReferenceUtilFunction · 0.80

Calls 1

StringMethod · 0.95

Tested by 1

TestReferenceUtilFunction · 0.64