You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/modules/ROOT/pages/installation/registry/registry.adoc
+61
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,67 @@ This should be within the standard convention adopted by https://docs.docker.com
56
56
57
57
NOTE: you can configure Camel K to use an insecure private registry. However, your Kubernetes cluster may not be able to https://github.com/apache/camel-k/issues/4720#issuecomment-1708228367[pull images from an insecure registry without proper configuration].
58
58
59
+
[[pruning-registry]]
60
+
== Pruning unused images from container registry
61
+
62
+
Over time, while building integrations the produced images are stored in the container registry and it may become outdated and may require pruning old unused images.
63
+
64
+
NOTE: Each container registry vendor can provide unique details about the pruning policy, check your vendor documentation.
65
+
66
+
NOTE: This is an unsupported functionality, use at your own risk.
67
+
68
+
It's recommended only to delete container images from container registry if the corresponding `Integration` or `IntegrationKit` doesn't exist anymore or has no expectation to be used. Then if you delete the container image, you should also delete corresponding `Integrationkit` custom resource object.
69
+
70
+
Camel K materializes the Camel integration in one of the two kubernetes objects: `Deployment` or `CronJob`.
71
+
72
+
You have to check if the `Integration` is running or scaled down to zero pods, which is the case for CronJobs or Knative deployments.
73
+
74
+
Then, we can provide some general guide about how to inspect the Camel K objects to prune unused images.
75
+
76
+
For this guide, we assume you are connected to the container registry with `docker login`.
77
+
78
+
Step 1: List all Camel K container images, prefixed with `camel-k`
79
+
80
+
```
81
+
$ docker images |grep k-kit
82
+
10.98.248.245/camel-k/camel-k-kit-cpth0mtf799b89lheon0 <none> bd52ae6e32af 54 years ago 481MB
83
+
10.98.248.245/camel-k/camel-k-kit-cptguntf799b89lheok0 <none> b7f347193b3c 54 years ago 471MB
84
+
10.98.248.245/camel-k/camel-k-kit-cptgv0tf799b89lheokg <none> 8d2d963396ca 54 years ago 477MB
85
+
10.98.248.245/camel-k/camel-k-kit-cpth0mtf799b89lheomg <none> dc11800ef203 54 years ago 481MB
86
+
10.98.248.245/camel-k/camel-k-kit-cptgvd5f799b89lheol0 <none> 0bbdf20f2f49 54 years ago 479MB
87
+
```
88
+
89
+
Step 2: List the container images of the Camel K Integrations (don't print the sha256 digest)
90
+
```
91
+
$ kubectl get -A it -oyaml|grep 'image:'|sed 's/^\s*image: //g;s/@sha256.*//g'|sort|uniq
Step 3: Compare them and remove the container images and `IntegrationKit` from list 1 not found in list 2
99
+
```
100
+
docker rmi dc11800ef203
101
+
kubectl delete ik/kit-cpth0mtf799b89lheomg
102
+
```
103
+
104
+
There is a https://github.com/apache/camel-k/blob/main/script/prune-camel-k-kit-images.sh[prune-camel-k-kit-images.sh] script to help you in this task. This script requires the following cli tools: `kubectl, comm, docker`.
105
+
The script lists the dangling images from the container registry, it accepts two parameters with no arguments: `-v` (verbose) and `-p` (prune images).
106
+
107
+
An example of an execution:
108
+
```
109
+
$ prune-camel-k-kit-images.sh -p
110
+
> Images from container registry, eligible for pruning.
0 commit comments