|
| 1 | +--- |
| 2 | +title: Azure Service Fabric container image management |
| 3 | +description: How to use container image management in a service fabric cluster. |
| 4 | +ms.topic: conceptual |
| 5 | +ms.author: shkadam |
| 6 | +author: shkadam |
| 7 | +ms.service: service-fabric |
| 8 | +services: service-fabric |
| 9 | +ms.date: 06/22/2023 |
| 10 | +--- |
| 11 | + |
| 12 | +# Container Image Management |
| 13 | +When deploying Service Fabric containers, the activation path handles the downloading of the container images to the VM on which the container will be running. Once the containers have been removed from the cluster and their application types have been unregistered, there is a clean up cycle that will delete the container images. This clean up works only if the container image has been hard coded in the service manifest. For existing Service Fabric runtime versions the configurations supporting the clean up of the container images are as follows - |
| 14 | + |
| 15 | +## Settings |
| 16 | + |
| 17 | + ```json |
| 18 | + "fabricSettings": [ |
| 19 | + { |
| 20 | + "name": "Hosting", |
| 21 | + "parameters": [ |
| 22 | + { |
| 23 | + "name": "PruneContainerImages", |
| 24 | + "value": "true" |
| 25 | + }, |
| 26 | + { |
| 27 | + "name": "CacheCleanupScanInterval", |
| 28 | + "value": "3600" |
| 29 | + } |
| 30 | + ] |
| 31 | + } |
| 32 | + ] |
| 33 | + ``` |
| 34 | + |
| 35 | +|Setting |Description | |
| 36 | + | --- | --- | |
| 37 | + |PruneContainerImage |Setting to enable or disable pruning of container images when application type is unregistered. | |
| 38 | + |CacheCleanupScanInterval |Setting in seconds determining how often the clean up cycle runs. | |
| 39 | + |
| 40 | +## Container Image Management v2 |
| 41 | +Starting Service Fabric version 10.0 there is a newer version of the container image deletion flow. This flow will clean up container images irrespective of how the container images may have been defined - either hard coded or parameterized during application deployment. PruneContainerImages and ContainerImageDeletionEnabled configuration are mutually exclusive and cluster upgrade validation exists to ensure one or the other is switched on but not both. The configuration supporting this feature are as follows - |
| 42 | + |
| 43 | +### Settings |
| 44 | + |
| 45 | +```json |
| 46 | + "fabricSettings": [ |
| 47 | + { |
| 48 | + "name": "Hosting", |
| 49 | + "parameters": [ |
| 50 | + { |
| 51 | + "name": "ContainerImageDeletionEnabled", |
| 52 | + "value": "true" |
| 53 | + }, |
| 54 | + { |
| 55 | + "name": "ContainerImageCleanupInterval", |
| 56 | + "value": "3600" |
| 57 | + }, |
| 58 | + { |
| 59 | + "name": "ContainerImageTTL", |
| 60 | + "value": "3600" |
| 61 | + }, |
| 62 | + { |
| 63 | + "name": "ContainerImageDeletionOnAppInstanceDeletionEnabled", |
| 64 | + "value": "true" |
| 65 | + }, |
| 66 | + { |
| 67 | + "name": "ContainerImagesToSkip", |
| 68 | + "value": "microsoft/windowsservercore|microsoft/nanoserver" |
| 69 | + } |
| 70 | + ] |
| 71 | + } |
| 72 | + ] |
| 73 | + ``` |
| 74 | + |
| 75 | +|Setting |Description | |
| 76 | + | --- | --- | |
| 77 | + |ContainerImageDeletionEnabled |Setting to enable or disable deletion of container images. | |
| 78 | + |ContainerImageCleanupInterval |Time interval for cleaning up unused container images. | |
| 79 | + |ContainerImageTTL |Time to live for container images once they are eligible for removal (not referenced by containers on the VM and the application is deleted(if ContainerImageDeletionOnAppInstanceDeletionEnabled is enabled)). | |
| 80 | + |ContainerImageDeletionOnAppInstanceDeletionEnabled |Setting to enable or disable deletion of expired ttl container images only after application has been deleted as well. | |
| 81 | + |ContainerImagesToSkip |When set enables the container runtime to skip deleting images that match any of the set of regular expressions. Each expression must be separated by the \| character. Example: "mcr.microsoft.com/.+\|docker.io/library/alpine:latest" - this example will match everything prefixed with "mcr.microsoft.com/" and will match exactly "docker.io/library/alpine:latest". By default we do not delete the known Windows base images microsoft/windowsservercore or microsoft/nanoserver. | |
| 82 | + |
| 83 | +## Next steps |
| 84 | +See the following article for related information: |
| 85 | +* [Service Fabric and containers][containers-introduction-link] |
0 commit comments