mirror of
https://github.com/docker/compose.git
synced 2025-07-21 20:54:32 +02:00
Fix corner case when there's no container to attach to
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
0234e13454
commit
8f991a20db
@ -37,6 +37,9 @@ func (s *composeService) attach(ctx context.Context, project *types.Project, lis
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if len(containers) == 0 {
|
||||||
|
return containers, nil
|
||||||
|
}
|
||||||
|
|
||||||
containers.sorted() // This enforce predictable colors assignment
|
containers.sorted() // This enforce predictable colors assignment
|
||||||
|
|
||||||
|
@ -110,8 +110,12 @@ func getDependencyCondition(service types.ServiceConfig, project *types.Project)
|
|||||||
type containerWatchFn func(container moby.Container) error
|
type containerWatchFn func(container moby.Container) error
|
||||||
|
|
||||||
// watchContainers uses engine events to capture container start/die and notify ContainerEventListener
|
// watchContainers uses engine events to capture container start/die and notify ContainerEventListener
|
||||||
func (s *composeService) watchContainers(ctx context.Context, projectName string, services, required []string,
|
func (s *composeService) watchContainers(ctx context.Context, //nolint:gocyclo
|
||||||
|
projectName string, services, required []string,
|
||||||
listener api.ContainerEventListener, containers Containers, onStart containerWatchFn) error {
|
listener api.ContainerEventListener, containers Containers, onStart containerWatchFn) error {
|
||||||
|
if len(containers) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if len(required) == 0 {
|
if len(required) == 0 {
|
||||||
required = services
|
required = services
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user