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

Function reconcile

pkg/compose/reconcile.go:112–142  ·  view source on GitHub ↗

reconcile is the main entry point: it builds a Plan from desired vs observed state. The prompt function is reserved for future interactive decisions (see the reconciler.prompt field).

(_ context.Context, project *types.Project, observed *ObservedState, options ReconcileOptions, prompt Prompt)

Source from the content-addressed store, hash-verified

110// The prompt function is reserved for future interactive decisions (see the
111// reconciler.prompt field).
112func reconcile(_ context.Context, project *types.Project, observed *ObservedState, options ReconcileOptions, prompt Prompt) (*Plan, error) {
113 r := &reconciler{
114 project: project,
115 observed: observed,
116 options: options,
117 prompt: prompt,
118 plan: &Plan{},
119 networkNodes: map[string]*PlanNode{},
120 volumeNodes: map[string]*PlanNode{},
121 serviceNodes: map[string]*PlanNode{},
122 stoppedByPlan: map[string]*PlanNode{},
123 recreatedServices: map[string]bool{},
124 observedContainersByService: observed.containersByService(),
125 }
126
127 if err := r.reconcileNetworks(); err != nil {
128 return nil, err
129 }
130
131 r.reconcileVolumes()
132
133 if err := r.reconcileContainers(); err != nil {
134 return nil, err
135 }
136
137 if r.options.RemoveOrphans {
138 r.reconcileOrphans()
139 }
140
141 return r.plan, nil
142}
143
144// reconcileNetworks adds plan nodes for network creation or recreation.
145func (r *reconciler) reconcileNetworks() error {

Calls 5

reconcileNetworksMethod · 0.95
reconcileVolumesMethod · 0.95
reconcileContainersMethod · 0.95
reconcileOrphansMethod · 0.95
containersByServiceMethod · 0.80