Kaynağa Gözat

dont restart container unless new hash

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

+ 2 - 7
docker/docker.go

@@ -197,13 +197,8 @@ func StartContainer(containerName string, containerType string) (structs.Contain
 		msg := fmt.Sprintf("Started stopped container %s", containerName)
 		logger.Info(msg)
 	default:
-		// if container is running, check the image tag
-		currentImage := existingContainer.Image
-		currentTag := strings.Split(currentImage, ":")[1]
-		logger.Info(fmt.Sprintf("DEBUG: Current image: %s, Current tag: %s, Desired tag: %s, Current ID: %s, Desired ID: %s", 
-		currentImage, currentTag, desiredTag, existingContainer.ImageID, desiredHash))
-		logger.Info(fmt.Sprintf("New %s image: %s@sha256:%s", containerType, desiredTag, desiredHash))
-		if 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
 			err := cli.ContainerRemove(ctx, containerName, types.ContainerRemoveOptions{Force: true})
 			if err != nil {