Adding container labels
This commit is contained in:
parent
077b324074
commit
1e09f9012d
@ -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
|
||||
}
|
||||
|
@ -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"`
|
||||
|
||||
|
@ -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"`
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user