Merge pull request #16736 from cpuguy83/16706_let_the_undead_keep_names
Don't let `Names` be null on GET /containers/JSON
This commit is contained in:
commit
da0cf69147
1 changed files with 5 additions and 1 deletions
|
@ -177,7 +177,7 @@ func (daemon *Daemon) foldFilter(config *ContainersConfig) (*listContext, error)
|
|||
}
|
||||
}
|
||||
|
||||
names := map[string][]string{}
|
||||
names := make(map[string][]string)
|
||||
daemon.containerGraph().Walk("/", func(p string, e *graphdb.Entity) error {
|
||||
names[e.ID()] = append(names[e.ID()], p)
|
||||
return nil
|
||||
|
@ -292,6 +292,10 @@ func (daemon *Daemon) transformContainer(container *Container, ctx *listContext)
|
|||
Names: ctx.names[container.ID],
|
||||
ImageID: container.ImageID,
|
||||
}
|
||||
if newC.Names == nil {
|
||||
// Dead containers will often have no name, so make sure the response isn't null
|
||||
newC.Names = []string{}
|
||||
}
|
||||
|
||||
img, err := daemon.Repositories().LookupImage(container.Config.Image)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue