@@ -20,7 +20,10 @@ import (
2020 t "github.com/containrrr/watchtower/pkg/types"
2121)
2222
23- const defaultStopSignal = "SIGTERM"
23+ const (
24+ defaultStopSignal = "SIGTERM"
25+ openContainerVersion = "org.opencontainers.image.version"
26+ )
2427
2528// A Client is the interface through which watchtower interacts with the
2629// Docker API.
@@ -192,6 +195,10 @@ func (client dockerClient) StopContainer(c t.Container, timeout time.Duration) e
192195 shortID := c .ID ().ShortID ()
193196
194197 if c .IsRunning () {
198+ openVer , ok := c .ContainerInfo ().Config .Labels [openContainerVersion ]
199+ if ok {
200+ shortID = fmt .Sprintf ("%s - %s" , shortID , openVer )
201+ }
195202 log .Infof ("Stopping %s (%s) with %s" , c .Name (), shortID , signal )
196203 if err := client .api .ContainerKill (bg , idStr , signal ); err != nil {
197204 return err
@@ -343,7 +350,13 @@ func (client dockerClient) HasNewImage(ctx context.Context, container t.Containe
343350 return false , currentImageID , nil
344351 }
345352
346- log .Infof ("Found new %s image (%s)" , imageName , newImageID .ShortID ())
353+ imageID := newImageID .ShortID ()
354+ openImageVer , ok := newImageInfo .Config .Labels [openContainerVersion ]
355+ if ok {
356+ imageID = fmt .Sprintf ("%s - %s" , imageID , openImageVer )
357+ }
358+
359+ log .Infof ("Found new %s image (%s)" , imageName , imageID )
347360 return true , newImageID , nil
348361}
349362
0 commit comments