diff --git a/daemon/daemon.go b/daemon/daemon.go index 38a107bba3..33ddb87ae4 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -85,6 +85,7 @@ func (daemon *Daemon) List() []*Container { for e := daemon.containers.Front(); e != nil; e = e.Next() { containers.Add(e.Value.(*Container)) } + containers.Sort() return *containers } diff --git a/daemon/history.go b/daemon/history.go index 57a00a2090..0b125ad2b3 100644 --- a/daemon/history.go +++ b/daemon/history.go @@ -26,5 +26,8 @@ func (history *History) Swap(i, j int) { func (history *History) Add(container *Container) { *history = append(*history, container) +} + +func (history *History) Sort() { sort.Sort(history) }