Kaynağa Gözat

dont restart container unless new hash

reid 2 yıl önce
ebeveyn
işleme
a4071fa798
1 değiştirilmiş dosya ile 9 ekleme ve 0 silme
  1. 9 0
      docker/docker.go

+ 9 - 0
docker/docker.go

@@ -196,6 +196,15 @@ func StartContainer(containerName string, containerType string) (structs.Contain
 		msg := fmt.Sprintf("Started stopped container %s", containerName)
 		logger.Info(msg)
 	default:
+		// debug
+		currentImage := existingContainer.Image
+		tagAndDigest := strings.Split(currentImage, ":")[1] // This will give "latest@sha256"
+		currentTag := strings.Split(tagAndDigest, "@")[0]   // This will give "latest"
+	
+		logger.Info(fmt.Sprintf("Current image: %s, Current tag: %s, Desired tag: %s, Current ID: %s, Desired ID: %s", 
+			currentImage, currentTag, desiredTag, existingContainer.ImageID, desiredHash))
+	
+		//
 		// if container is running, check the image hash
 		if existingContainer.ImageID != desiredHash {
 			// if the hashes don't match, recreate the container with the new one