How to cleanup old containers from Gitlab Registry?

Hi,

Our Gitlab Registry stores Docker images on S3. It works good for us.
So we configured our CI pipeline to prepare container for each build of each service.

I suppose in short time we’ll have hundreds of thousands of old containers, which we needn’t anymore. So we need a way to cleanup old containers. I’m sure we can configure S3 bucket to cleanup old objects, but it can be unexpected by Gitlab.

Is there a recommended way to cleanup old Docker images from registry? Does Gitlab provide any API for such task?

Thanks in advance.