b7daa2f3a4
Update traefik dependencies (docker/docker and related) - Update dependencies - Fix compilation problems - Remove vdemeester/docker-events (in docker api now) - Remove `integration/vendor` - Use `testImport` - update some deps. - regenerate the lock from scratch (after a `glide cc`)
25 lines
557 B
Go
25 lines
557 B
Go
package docker
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"golang.org/x/net/context"
|
|
|
|
"github.com/docker/docker/api/types"
|
|
"github.com/docker/docker/api/types/filters"
|
|
)
|
|
|
|
// List lists the containers managed by kermit
|
|
func (p *Project) List() ([]types.Container, error) {
|
|
filters := filters.NewArgs()
|
|
for key, value := range p.Labels {
|
|
filters.Add("label", fmt.Sprintf("%s=%s", key, value))
|
|
}
|
|
containers, err := p.Client.ContainerList(context.Background(), types.ContainerListOptions{
|
|
Filters: filters,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return containers, nil
|
|
}
|