func (c Container) IsCreatedByTugbot() bool {
	val, ok := c.containerInfo.Config.Labels[TugbotCreatedFrom]
	return ok && val != ""
}
IsCreatedByTugbot returns whether or not a container created by tugbot.
package container
import (
	log "github.com/Sirupsen/logrus"
	"github.com/samalba/dockerclient"
	"fmt"
	"strings"
	"time"
)
const (
	TugbotService     = "tugbot-service"
	TugbotTest        = "tugbot-test"
	TugbotEventDocker = "tugbot-event-docker"
	TugbotEventTimer  = "tugbot-event-timer"
	TugbotCreatedFrom = "tugbot-created-from"
	SwarmTaskID       = "com.docker.swarm.task.id"
)
const (
	TypeFilter = "tugbot-event-docker-filter-type"
	ActionFilter = "tugbot-event-docker-filter-action"
	ContainerFilter = "tugbot-event-docker-filter-container"
	ImageFilter = "tugbot-event-docker-filter-image"
	LabelFilter = "tugbot-event-docker-filter-label"
)
func NewContainer(containerInfo *dockerclient.ContainerInfo, imageInfo *dockerclient.ImageInfo) *Container {
	return &Container{
		containerInfo: containerInfo,
		imageInfo:     imageInfo,
	}
}
type Container struct {
	containerInfo *dockerclient.ContainerInfo
	imageInfo     *dockerclient.ImageInfo
}
func (c Container) ID() string {
	return c.containerInfo.Id
}
func (c Container) Name() string {
	return strings.TrimPrefix(c.containerInfo.Name, "/")
}
func (c Container) ImageID() string {
	return c.imageInfo.Id
}
func (c Container) ImageName() string {
	imageName := c.containerInfo.Config.Image
	if !strings.Contains(imageName, ":") {
		imageName = fmt.Sprintf("%s:latest", imageName)
	}
	return imageName
}
func (c Container) IsTugbot() bool {
	val, ok := c.containerInfo.Config.Labels[TugbotService]
	return ok && val == "true"
}
func (c Container) IsTugbotCandidate() bool {
	ret := false
	val, ok := c.containerInfo.Config.Labels[TugbotTest]
	if ok && val == "true" {
		if !c.IsCreatedByTugbot() {
			ret = c.containerInfo.State.StateString() == "exited"
		}
	}
	return ret
}