mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
docker-top: improve error message for non-running containers
Signed-off-by: Tzu-Jung Lee <roylee17@gmail.com>
This commit is contained in:
parent
3fe4d5477a
commit
b1a3a55802
1 changed files with 3 additions and 0 deletions
|
@ -698,6 +698,9 @@ func (srv *Server) ImageHistory(name string) ([]APIHistory, error) {
|
|||
|
||||
func (srv *Server) ContainerTop(name, psArgs string) (*APITop, error) {
|
||||
if container := srv.runtime.Get(name); container != nil {
|
||||
if !container.State.IsRunning() {
|
||||
return nil, fmt.Errorf("Container %s is not running", name)
|
||||
}
|
||||
pids, err := utils.GetPidsForContainer(container.ID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Reference in a new issue