MCPcopy Create free account
hub / github.com/containers/image / splitDockerDomain

Function splitDockerDomain

docker/reference/normalize.go:90–104  ·  view source on GitHub ↗

splitDockerDomain splits a repository name to domain and remotename string. If no valid domain is found, the default domain is used. Repository name needs to be already validated before.

(name string)

Source from the content-addressed store, hash-verified

88// If no valid domain is found, the default domain is used. Repository name
89// needs to be already validated before.
90func splitDockerDomain(name string) (domain, remainder string) {
91 i := strings.IndexRune(name, '/')
92 if i == -1 || (!strings.ContainsAny(name[:i], ".:") && name[:i] != "localhost") {
93 domain, remainder = defaultDomain, name
94 } else {
95 domain, remainder = name[:i], name[i+1:]
96 }
97 if domain == legacyDefaultDomain {
98 domain = defaultDomain
99 }
100 if domain == defaultDomain && !strings.ContainsRune(remainder, '/') {
101 remainder = officialRepoName + "/" + remainder
102 }
103 return
104}
105
106// familiarizeName returns a shortened version of the name familiar
107// to the Docker UI. Familiar names have the default domain

Callers 1

ParseNormalizedNamedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…