(ctx context.Context, op Operation)
| 134 | } |
| 135 | |
| 136 | func (exec *planExecutor) execRemoveContainer(ctx context.Context, op Operation) error { |
| 137 | _, err := exec.compose.apiClient().ContainerRemove(ctx, op.Container.ID, client.ContainerRemoveOptions{Force: true}) |
| 138 | if err != nil { |
| 139 | return err |
| 140 | } |
| 141 | // Why: a dependent service's create may resolve `network_mode: service:X` |
| 142 | // (or volumes_from / ipc / pid) against the live view. Containers.sorted() |
| 143 | // orders by canonical name; without this drop, a just-removed container |
| 144 | // can still win the lookup and the dependent receives a container:<id> |
| 145 | // reference that no longer exists in the daemon. |
| 146 | svcName := op.Container.Labels[api.ServiceLabel] |
| 147 | exec.containersMu.Lock() |
| 148 | exec.containersByService[svcName] = slices.DeleteFunc( |
| 149 | exec.containersByService[svcName], |
| 150 | func(c container.Summary) bool { return c.ID == op.Container.ID }, |
| 151 | ) |
| 152 | exec.containersMu.Unlock() |
| 153 | return nil |
| 154 | } |
| 155 | |
| 156 | func (exec *planExecutor) execRenameContainer(ctx context.Context, node *PlanNode) error { |
| 157 | op := node.Operation |
no test coverage detected