Add documentation for cleaning images
This commit is contained in:
parent
845b4a23f8
commit
10fb248aea
1 changed files with 28 additions and 0 deletions
28
README.md
28
README.md
|
@ -38,3 +38,31 @@ podman push <image name> docker://<host name>:5000/<image name>
|
|||
```
|
||||
|
||||
To use it in Kubernetes, see <https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/>
|
||||
|
||||
## Maintenance
|
||||
|
||||
### Remove images / tags
|
||||
|
||||
In short:
|
||||
|
||||
* login to the registry container
|
||||
* delete the directories keeping the metadata of the images and tags
|
||||
* run command *registry garbage_collect* to delete the unreferenced blobs
|
||||
|
||||
In practice:
|
||||
|
||||
```bash
|
||||
## Login to the machine with the dedicated user
|
||||
ssh registry@tiptop
|
||||
## Run a shell in a registry container
|
||||
# podman run -it --rm myregistry sh # if the registry is not started
|
||||
podman exec -it mycontainer sh
|
||||
# List all images and their tags
|
||||
ls -lsd /var/lib/registry/docker/registry/v2/repositories/*/_manifests/tags/*
|
||||
## To remove an image with all its tags:
|
||||
rm -rf /var/lib/registry/docker/registry/v2/repositories/image_to_be_deleted
|
||||
## To remove only a tag, eg "latest":
|
||||
rm -rf /var/lib/registry/docker/registry/v2/repositories/image_to_be_deleted/_manifests/tags/latest
|
||||
## Clean up the unreferenced blobs
|
||||
registry garbage-collect -m /etc/docker/registry/config.yml
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue