Adding container labels

This commit is contained in:
Victor Marmol 2015-04-30 08:05:29 -07:00
parent 077b324074
commit 1e09f9012d
3 changed files with 11 additions and 0 deletions

View File

@ -68,6 +68,9 @@ type dockerContainerHandler struct {
// Time at which this container was created.
creationTime time.Time
// Metadata labels associated with the container.
labels map[string]string
}
func newDockerContainerHandler(
@ -115,6 +118,7 @@ func newDockerContainerHandler(
// Add the name and bare ID as aliases of the container.
handler.aliases = append(handler.aliases, strings.TrimPrefix(ctnr.Name, "/"))
handler.aliases = append(handler.aliases, id)
handler.labels = ctnr.Config.Labels
return handler, nil
}
@ -184,6 +188,7 @@ func (self *dockerContainerHandler) GetSpec() (info.ContainerSpec, error) {
if self.usesAufsDriver {
spec.HasFilesystem = true
}
spec.Labels = self.labels
return spec, err
}

View File

@ -43,6 +43,9 @@ type ContainerSpec struct {
// Time at which the container was created.
CreationTime time.Time `json:"creation_time,omitempty"`
// Metadata labels associated with this container.
Labels map[string]string `json:"labels,omitempty"`
HasCpu bool `json:"has_cpu"`
Cpu CpuSpec `json:"cpu,omitempty"`

View File

@ -64,6 +64,9 @@ type ContainerSpec struct {
// An example of a namespace is "docker" for Docker containers.
Namespace string `json:"namespace,omitempty"`
// Metadata labels associated with this container.
Labels map[string]string `json:"labels,omitempty"`
HasCpu bool `json:"has_cpu"`
Cpu CpuSpec `json:"cpu,omitempty"`