Merge pull request #3324 from roylee17/enhance-docker-top-err-msg
docker-top: improve error message for non-running containers
This commit is contained in:
commit
7ec1236cee
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