MCPcopy
hub / github.com/docker/compose / serviceHashWithResolvedRefs

Function serviceHashWithResolvedRefs

pkg/compose/reconcile.go:594–599  ·  view source on GitHub ↗

serviceHashWithResolvedRefs mirrors what the executor persists at create time: service references (network_mode/ipc/pid: service:X, volumes_from) are resolved against the observed containers snapshot before hashing. On resolution failure (e.g. referenced parent absent) the raw form is hashed — it ca

(svc types.ServiceConfig, containers map[string]Containers)

Source from the content-addressed store, hash-verified

592// svc.Networks (a map) is left shared because resolveServiceReferences does
593// not touch it; revisit if that changes.
594func serviceHashWithResolvedRefs(svc types.ServiceConfig, containers map[string]Containers) (string, error) {
595 resolved := svc
596 resolved.VolumesFrom = slices.Clone(svc.VolumesFrom)
597 _ = resolveServiceReferences(&resolved, containers)
598 return ServiceHash(resolved)
599}
600
601// hasNetworkMismatch checks if the container is not connected to all expected networks.
602func (r *reconciler) hasNetworkMismatch(expected types.ServiceConfig, oc ObservedContainer) bool {

Callers 2

reconcileServiceMethod · 0.85
mustResolvedServiceHashFunction · 0.85

Calls 2

resolveServiceReferencesFunction · 0.85
ServiceHashFunction · 0.85

Tested by 1

mustResolvedServiceHashFunction · 0.68