mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-16 15:10:12 +01:00
Add comments that describe original image info overwriting
This commit is contained in:
parent
85ea00f3ad
commit
ebe3fafeef
2 changed files with 9 additions and 3 deletions
|
|
@ -329,10 +329,12 @@ func (client dockerClient) IsContainerStale(container t.Container, params t.Upda
|
|||
}
|
||||
|
||||
func (client dockerClient) HasNewImage(ctx context.Context, container t.Container) (hasNew bool, latestImage t.ImageID, err error) {
|
||||
currentImageID := t.ImageID(container.ContainerInfo().ContainerJSONBase.Image)
|
||||
container_info := container.ContainerInfo()
|
||||
currentImageID := t.ImageID(container_info.ContainerJSONBase.Image)
|
||||
imageName := container.ImageName()
|
||||
|
||||
imageIDSetByLabel, ok := container.ContainerInfo().Config.Labels[originalImageIDLabel]
|
||||
// If the original-image-id label is set, it overwrites the image id reported by docker
|
||||
imageIDSetByLabel, ok := container_info.Config.Labels[originalImageIDLabel]
|
||||
if ok {
|
||||
currentImageID = t.ImageID(imageIDSetByLabel)
|
||||
log.Infof("Original image id for %s found: (%s)", imageName, currentImageID.ShortID())
|
||||
|
|
|
|||
|
|
@ -103,7 +103,11 @@ func (c Container) SafeImageID() wt.ImageID {
|
|||
// "latest" tag is assumed.
|
||||
func (c Container) ImageName() string {
|
||||
// Compatibility w/ Zodiac deployments
|
||||
imageName, ok := c.getLabelValue(originalImageNameLabel)
|
||||
imageName, ok := c.getLabelValue(zodiacLabel)
|
||||
// If the original-image-name label is set, it overwrites the image name reported by docker
|
||||
if !ok {
|
||||
imageName, ok = c.getLabelValue(originalImageNameLabel)
|
||||
}
|
||||
if !ok {
|
||||
imageName = c.containerInfo.Config.Image
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue