File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -156,6 +156,9 @@ func runStats(dockerCli command.Cli, opts *statsOptions) error {
156
156
// Start a short-lived goroutine to retrieve the initial list of
157
157
// containers.
158
158
getContainerList ()
159
+
160
+ // make sure each container get at least one valid stat data
161
+ waitFirst .Wait ()
159
162
} else {
160
163
// Artificially send creation events for the containers we were asked to
161
164
// monitor (same code path than we use when monitoring all containers).
@@ -170,9 +173,9 @@ func runStats(dockerCli command.Cli, opts *statsOptions) error {
170
173
// We don't expect any asynchronous errors: closeChan can be closed.
171
174
close (closeChan )
172
175
173
- // Do a quick pause to detect any error with the provided list of
174
- // container names.
175
- time . Sleep ( 1500 * time . Millisecond )
176
+ // make sure each container get at least one valid stat data
177
+ waitFirst . Wait ()
178
+
176
179
var errs []string
177
180
cStats .mu .Lock ()
178
181
for _ , c := range cStats .cs {
@@ -186,8 +189,6 @@ func runStats(dockerCli command.Cli, opts *statsOptions) error {
186
189
}
187
190
}
188
191
189
- // before print to screen, make sure each container get at least one valid stat data
190
- waitFirst .Wait ()
191
192
format := opts .format
192
193
if len (format ) == 0 {
193
194
if len (dockerCli .ConfigFile ().StatsFormat ) > 0 {
You can’t perform that action at this time.
0 commit comments