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

Function getScale

pkg/compose/convergence.go:52–60  ·  view source on GitHub ↗

convergence manages service's container lifecycle. Based on initially observed state, it reconciles the existing container with desired state, which might include re-creating container, adding or removing replicas, or starting stopped containers. Cross services dependencies are managed by creating s

(config types.ServiceConfig)

Source from the content-addressed store, hash-verified

50// Cross services dependencies are managed by creating services in expected order and updating `service:xx` reference
51// when a service has converged, so dependent ones can be managed with resolved containers references.
52func getScale(config types.ServiceConfig) (int, error) {
53 scale := config.GetScale()
54 if scale > 1 && config.ContainerName != "" {
55 return 0, fmt.Errorf(doubledContainerNameWarning,
56 config.Name,
57 config.ContainerName)
58 }
59 return scale, nil
60}
61
62// resolveServiceReferences replaces references to other services with references
63// to actual container IDs. It resolves VolumesFrom, NetworkMode, IPC and PID

Callers 2

reconcileServiceMethod · 0.85
TestContainerNameFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestContainerNameFunction · 0.68