docs/doc/source/admintasks/kubernetes/freeing-space-in-the-local-docker-registry.rst
Elisamara Aoki Goncalves ca817481bd Add note about command "system registry-garbage-collect" (r6,r8,dsR8,dsR6)
Closes-bug: 2033096

Change-Id: Ibc093b7eebcc5c5f75b4277bdaf2f91b0c50bd78
Signed-off-by: Elisamara Aoki Goncalves <elisamaraaoki.goncalves@windriver.com>
2023-08-25 18:23:30 +00:00

3.7 KiB

Free Space in the Local Docker Registry

You can delete images and perform garbage collection to free unused registry space on the docker-distribution file system of the controllers.

Simply deleting an image from the local Docker registry does not free the associated space from the file system. To do so, you must also run the registry-garbage-collect command.

  1. Identify the name of the image you want to delete.

    ~(keystone_admin)]$ system registry-image-list
    
    +------------------------------------------------------+
    | Image Name                                           |
    +------------------------------------------------------+
    | ghcr.io/k8snetworkplumbingwg/sriov-cni               |
    | docker.io/starlingx/k8s-plugins-sriov-network-device |
    | docker.io/starlingx/multus                           |
    | gcr.io/kubernetes-helm/tiller                        |
    | k8s.gcr.io/coredns                                   |
    | k8s.gcr.io/etcd                                      |
    | k8s.gcr.io/kube-apiserver                            |
    | k8s.gcr.io/kube-controller-manager                   |
    | k8s.gcr.io/kube-proxy                                |
    | k8s.gcr.io/kube-scheduler                            |
    | k8s.gcr.io/pause                                     |
    | quay.io/airshipit/armada                             |
    | quay.io/calico/cni                                   |
    | quay.io/calico/kube-controllers                      |
    | quay.io/calico/node                                  |
    +------------------------------------------------------+
  2. Find tags associated with the image.

    ~(keystone_admin)]$ system registry-image-tags <imageName>
  3. Free file system space.

    ~(keystone_admin)]$ system registry-image-delete <imageName>:<tagName>

    This step only removes the registry's reference to the image:tag.

    Warning

    Do not delete image:tags that are currently being used by the system. Deleting both the local Docker registry's image:tags and the image:tags from the Docker cache will prevent failed deployment pods from recovering. If this happens, you will need to manually download the deleted image from the same source and push it back into the local Docker registry under the same name and tag.

    If you need to free space consumed by -openstack images, you can delete older tagged versions.

  4. Free up file system space associated with the deleted/unreferenced images.

    The registry-garbage-collect command removes unreferenced image:tags from the file system and frees the file system spaces allocated to deleted/unreferenced images.

    Note

    The registry-garbage-collect command executes background tasks that may affect access to the docker registry. It is recommended to wait a few minutes before executing other registry related commands.

    ~(keystone_admin)]$ system registry-garbage-collect
    Running docker registry garbage collect

    Note

    In rare cases the system may trigger a swact during garbage collection, and the registry may be left in read-only mode. If this happens, run registry-garbage-collect again to take the registry out of read-only mode.