isOrphaned is a predicate to select containers without a matching service definition in compose project
(project *types.Project)
| 144 | |
| 145 | // isOrphaned is a predicate to select containers without a matching service definition in compose project |
| 146 | func isOrphaned(project *types.Project) containerPredicate { |
| 147 | services := append(project.ServiceNames(), project.DisabledServiceNames()...) |
| 148 | return func(c container.Summary) bool { |
| 149 | // One-off container |
| 150 | v, ok := c.Labels[api.OneoffLabel] |
| 151 | if ok && v == "True" { |
| 152 | return c.State == container.StateExited || c.State == container.StateDead |
| 153 | } |
| 154 | // Service that is not defined in the compose model |
| 155 | service := c.Labels[api.ServiceLabel] |
| 156 | return !slices.Contains(services, service) |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | func isNotOneOff(c container.Summary) bool { |
| 161 | v, ok := c.Labels[api.OneoffLabel] |
no outgoing calls
no test coverage detected