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
|
@ -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…
Reference in New Issue