mirror of
				https://github.com/docker/compose.git
				synced 2025-11-04 05:34:09 +01:00 
			
		
		
		
	allow for 0 scale/replicas
Signed-off-by: JD Lloret <jd.lloret@joyent.com>
This commit is contained in:
		
							parent
							
								
									54dc6f9374
								
							
						
					
					
						commit
						c82dd55fd2
					
				@ -111,6 +111,9 @@ var mu sync.Mutex
 | 
				
			|||||||
// updateProject updates project after service converged, so dependent services relying on `service:xx` can refer to actual containers.
 | 
					// updateProject updates project after service converged, so dependent services relying on `service:xx` can refer to actual containers.
 | 
				
			||||||
func (c *convergence) updateProject(project *types.Project, service string) {
 | 
					func (c *convergence) updateProject(project *types.Project, service string) {
 | 
				
			||||||
	containers := c.getObservedState(service)
 | 
						containers := c.getObservedState(service)
 | 
				
			||||||
 | 
						if len(containers) == 0 {
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	container := containers[0]
 | 
						container := containers[0]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// operation is protected by a Mutex so that we can safely update project.Services while running concurrent convergence on services
 | 
						// operation is protected by a Mutex so that we can safely update project.Services while running concurrent convergence on services
 | 
				
			||||||
@ -557,6 +560,9 @@ func (s *composeService) startService(ctx context.Context, project *types.Projec
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if len(containers) == 0 {
 | 
						if len(containers) == 0 {
 | 
				
			||||||
 | 
							if scale, err := getScale(service); err != nil && scale == 0 {
 | 
				
			||||||
 | 
								return nil
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		return fmt.Errorf("no containers to start")
 | 
							return fmt.Errorf("no containers to start")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user