mirror of
https://github.com/containrrr/watchtower.git
synced 2026-02-05 07:01:49 +01:00
Added container labels to ContainerReport interface
This commit is contained in:
parent
36391b0ae7
commit
ee49fb953e
7 changed files with 816 additions and 3 deletions
|
|
@ -76,6 +76,11 @@ func (c Container) IsRestarting() bool {
|
|||
return c.containerInfo.State.Restarting
|
||||
}
|
||||
|
||||
// Labels returns a map of all the labels present on the container
|
||||
func (c Container) Labels() map[string]string {
|
||||
return c.containerInfo.Config.Labels
|
||||
}
|
||||
|
||||
// Name returns the Docker container name.
|
||||
func (c Container) Name() string {
|
||||
return c.containerInfo.Name
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ type ContainerStatus struct {
|
|||
containerName string
|
||||
imageName string
|
||||
error
|
||||
state State
|
||||
state State
|
||||
labels map[string]string
|
||||
}
|
||||
|
||||
// ID returns the container ID
|
||||
|
|
@ -61,6 +62,11 @@ func (u *ContainerStatus) Error() string {
|
|||
return u.error.Error()
|
||||
}
|
||||
|
||||
// Labels returns a map of all labels present on the container
|
||||
func (u *ContainerStatus) Labels() map[string]string {
|
||||
return u.labels
|
||||
}
|
||||
|
||||
// State returns the current State that the container is in
|
||||
func (u *ContainerStatus) State() string {
|
||||
switch u.state {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ func UpdateFromContainer(cont types.Container, newImage types.ImageID, state Sta
|
|||
containerID: cont.ID(),
|
||||
containerName: cont.Name(),
|
||||
imageName: cont.ImageName(),
|
||||
labels: cont.Labels(),
|
||||
oldImage: cont.SafeImageID(),
|
||||
newImage: newImage,
|
||||
state: state,
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ type Container interface {
|
|||
GetLifecyclePostUpdateCommand() string
|
||||
VerifyConfiguration() error
|
||||
SetStale(bool)
|
||||
Labels() map[string]string
|
||||
IsStale() bool
|
||||
IsNoPull() bool
|
||||
SetLinkedToRestarting(bool)
|
||||
|
|
|
|||
|
|
@ -20,4 +20,5 @@ type ContainerReport interface {
|
|||
ImageName() string
|
||||
Error() string
|
||||
State() string
|
||||
Labels() map[string]string
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue