1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
Commit graph

15 commits

Author SHA1 Message Date
Tibor Vass
febbe38796 Manually reorganize import paths to segregate stdlib and 3rd-party packages
Signed-off-by: Tibor Vass <tibor@docker.com>
2017-03-27 18:21:59 -07:00
Daniel Nephin
7b7ea8ab81 Replace fmt.Errorf() with errors.Errorf() in the cli
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-03-24 16:58:07 -04:00
Yong Tang
0a3a3ba2b6 Fix Windows docker stats showing Linux headers
This fix is an attempt to fix issue raised in #28005 where
`docker stats` on Windows shows Linux headers if there is
no containers in stats.

The reason for the issue is that, in case there is no container,
a header is faked in:
https://github.com/docker/docker/blob/v1.13.0/cli/command/formatter/formatter.go#L74-L78
which does not know OS type information (as OS was stored with container stat entries)

This fix tries to fix the issue by moving OS type information
to stats context (instead of individual container stats entry).

Additional unit tests have been added.

This fix fixes #28005.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-02-05 08:55:30 -08:00
Sebastiaan van Stijn
d5179cb4d4
Minor cleanups in cli/command/container
This change does some minor cleanups in the
cli/command/container package;

- sort imports
- replace `fmt.Fprintf()` with `fmt.Fprintln()` if no formatting is used
- replace `fmt.Errorf()` with `errors.New()` if no formatting is used
- remove some redundant `else`'s

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-12-26 01:33:25 +01:00
Yong Tang
32de162fc9 Improve error output for docker stats ...
While looking into `docker stats <c1> <c2> ...` I noticed that
the error output is quite long, especially if there are multiple errors:
```sh
ubuntu@ubuntu:~/docker$ docker stats nofound
: Error response from daemon: No such container: nofound
ubuntu@ubuntu:~/docker$ docker stats nofound foo bar
: Error response from daemon: No such container: nofound, : Error response from daemon: No such container: foo, : Error response from daemon: No such container: bar
```

There are several issues,
1. There is an extra `: ` at the beginning. That is because if container is not found,
the name will not be available from the daemon.
2. Multiple errors are concatenated with `, ` which will be quite long.

This fix:
1. Only prient out the error from daemon.
2. Multiple errors are printed out line by line.

Below is the new output:
```sh
ubuntu@ubuntu:~/docker$ docker stats nofound
Error response from daemon: No such container: nofound
ubuntu@ubuntu:~/docker$ docker stats nofound foo bar
Error response from daemon: No such container: nofound
Error response from daemon: No such container: foo
Error response from daemon: No such container: bar
```

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-12-17 16:51:11 -08:00
yupeng
aff5dacec1 context.Context should be the first parameter of a function
Signed-off-by: yupeng <yu.peng36@zte.com.cn>
2016-11-12 14:14:34 +08:00
Vincent Demeester
12cae3a590
Add StatsFormat to the config.json file
As for `ps`, `images`, `network ls` and `volume ls`, this makes it
possible to define a custom default format.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-10-28 11:48:25 -07:00
John Howard
2894d07696 Windows: Fix stats CLI
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-10-25 19:57:47 -07:00
Sebastiaan van Stijn
ba2c13fcf5 Merge pull request #26819 from ripcurld00d/fix_stats_mutex
Hide the mutex lock in formatter.ContainerStats
2016-10-13 17:38:22 -07:00
Boaz Shuster
929a77b814 Hide the mutex in formatter.ContainerStats
The formatter.ContainerStats struct exposes its Mutex.
This is a bad design and should be fixed.

To fix that, I separated the statistics
attributes from ContainerStats to StatsEntry and
hid the mutex. Notice that the mutex protects both
the `err` field and the statistics attributes.

Then, implemented SetStatistics, SetError, GetStatistics
and GetError to avoid races.

Moreover, to make this less granular, I decided to
replace the read-write mutex with the regular mutex and
to pass a StatsEntry slice to formatter.ContainerStatsWrite

Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
2016-10-10 21:52:53 +03:00
Kenfe-Mickael Laventure
280c872366 Add subcommand prune to the container, volume, image and system commands
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-09-29 07:42:53 -07:00
Josh Horwitz
d6bd79c18f Refactor to new events api
Signed-off-by: Josh Horwitz <horwitzja@gmail.com>
2016-09-22 14:42:06 -04:00
Boaz Shuster
96622b2a7d Add the format switch to the stats command
Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com>
2016-09-18 14:16:13 +03:00
John Howard
340e5233b2 Windows: stats support
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-16 11:56:15 -07:00
Daniel Nephin
0640a14b4f Move api/client -> cli/command
Using
  gomvpkg
     -from github.com/docker/docker/api/client
     -to github.com/docker/docker/cli/command
     -vcs_mv_cmd 'git mv {{.Src}} {{.Dst}}'

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2016-09-08 15:46:29 -04:00
Renamed from api/client/container/stats.go (Browse further)