注册表在执行 Docker 搜索时无法在存储库中找到所有图像

Registry can't find all images in the repository when doing Docker search

我想我知道为什么会这样,docker 注册表容器丢失了推送到存储库的记录,我希望直接针对后端进行搜索(在我的情况下,我使用 s3 存储桶)。我有一个云模板,所以我经常从头开始我的堆栈,重新下载注册表容器,设置所有配置,当然我丢失了我推送到 repo 的图像的所有数据。我的 ec2 实例 运行 docker 注册表容器可以因任何原因更新或关闭,自动缩放组将启动一个全新的实例。

所以我的问题基本上是,执行搜索时始终连接到注册表并始终看到 s3 存储库中的所有图像的最佳可用方法是什么,无论是重新启动注册表还是启动新注册表?从 ec2 实例安装卷将不起作用,因为 ec2 实例很可能会在某个时间点与 docker 注册表容器一起关闭。

我假设您使用 sqlalchemy 搜索后端。我相信您可能会丢失有关您推送的图像的数据,因为搜索后端默认将数据存储在本地。 docker 注册表论坛 https://github.com/docker/docker-registry/issues/475 讨论了这种情况及其解决方法,来自该页面:

By default, the search backend uses a sqlite database locally. You can configure that by changing the connection string to a database somewhere external to your autoscaling group or within the confines of the VPC (if you're using one, that is). Could this be the issue you're seeing?

讨论继续建议将外部数据库放在某个地方,可能是在 EC2 上,如果它出现故障并恢复为空,则无需担心,因为空数据库将由注册表。