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.

About this task

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.

Procedure

  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 stx-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.