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

Method parentNamespaceRecreated

pkg/compose/reconcile.go:567–583  ·  view source on GitHub ↗

parentNamespaceRecreated reports whether any namespace- or volume-sharing parent of svc has at least one container scheduled for recreation. The parent set is derived from svc itself (network_mode/ipc/pid and volumes_from) rather than depends_on, so the cascade fires only when a stale "container:<id

(svc types.ServiceConfig)

Source from the content-addressed store, hash-verified

565// rather than depends_on, so the cascade fires only when a stale
566// "container:<id>" reference would otherwise be left behind.
567func (r *reconciler) parentNamespaceRecreated(svc types.ServiceConfig) bool {
568 for _, mode := range []string{svc.NetworkMode, svc.Ipc, svc.Pid} {
569 if name := getDependentServiceFromMode(mode); name != "" && r.recreatedServices[name] {
570 return true
571 }
572 }
573 for _, vol := range svc.VolumesFrom {
574 if strings.HasPrefix(vol, types.ContainerPrefix) {
575 continue
576 }
577 name, _, _ := strings.Cut(vol, ":")
578 if r.recreatedServices[name] {
579 return true
580 }
581 }
582 return false
583}
584
585// serviceHashWithResolvedRefs mirrors what the executor persists at create
586// time: service references (network_mode/ipc/pid: service:X, volumes_from) are

Callers 1

reconcileServiceMethod · 0.95

Calls 1

Tested by

no test coverage detected