File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,9 @@ import (
12
12
"text/template"
13
13
"time"
14
14
15
+ "github.com/docker/docker/api/types"
15
16
"github.com/docker/docker/api/types/container"
17
+ "github.com/docker/docker/pkg/stdcopy"
16
18
"github.com/docker/go-connections/nat"
17
19
"github.com/jackc/pgx/v4"
18
20
"github.com/spf13/afero"
@@ -481,6 +483,22 @@ func waitForServiceReady(ctx context.Context, started []string) error {
481
483
return len (started ) == 0
482
484
}
483
485
if ! reset .RetryEverySecond (ctx , probe , 20 * time .Second ) {
486
+ // Print container logs for easier debugging
487
+ for _ , container := range started {
488
+ logs , err := utils .Docker .ContainerLogs (ctx , container , types.ContainerLogsOptions {
489
+ ShowStdout : true ,
490
+ ShowStderr : true ,
491
+ })
492
+ if err != nil {
493
+ fmt .Fprintln (os .Stderr , err )
494
+ continue
495
+ }
496
+ fmt .Fprintln (os .Stderr , container , "container logs:" )
497
+ if _ , err := stdcopy .StdCopy (os .Stderr , os .Stderr , logs ); err != nil {
498
+ fmt .Fprintln (os .Stderr , err )
499
+ }
500
+ logs .Close ()
501
+ }
484
502
return fmt .Errorf ("%w: %v" , errUnhealthy , started )
485
503
}
486
504
return nil
You can’t perform that action at this time.
0 commit comments