在不同帐户中的ECR之间复制容器图像的最佳实践
我想知道在AWS中将Docker容器图像从ECR复制到ECR的最佳实践是什么。
我必须在多个ECR存储库之间定期复制容器图像,每个存储库都放在单独的AWS帐户中 - 例如镜像,但具有特定的滤镜,以复制什么和跳过。我编写了一个脚本,可以通过将遗漏的图像从“源” ECR提取到EC2 VM,然后将其推到“ Target” ECR。 这有效,但是我对在单个线程中执行此操作的性能并不满意,并且不是网络吞吐量限制它,而是“支出”以包装命令,对AWS进行一些必要的调用等。
因此,我正在考虑重写脚本到多线程应用程序,但我想知道我是否正在发明自行车,并且有一些已知的和更好的解决方案来解决此任务。
I wonder what are best practices for copying Docker container images from ECR to ECR in AWS.
I have to copy container images periodically between multiple ECR repositories, each placed in separate AWS account - like mirroring but with specific filters for what to copy and what to skip. I wrote a script that does this work by pulling missed images from the 'source' ECR to an EC2 VM, and pushes them to the 'target' ECR.
This works, but I am not satisfied by the performance of doing that in a single thread, and it's not network throughput limiting it but 'expences' to wrap commands, run some necessary calls to AWS, etc.
So I am thinking of rewriting the script to a multi-thread application, but I wonder if I'm inventing a bicycle, and there is some known and better solution for this task.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如AWS支持所证实的那样,除了直接镜像整个存储库以外,没有“开箱即用”的方法。
因此,我重写了以更聪明,更快的方式进行操作的工具,并发布了它。
https://github.com/github.com/dfad1ripe/aws-ecr-cross-cross-cross-acccount-克隆
要使用它,源和目标AWS帐户都应定义为〜/.aws/凭据中的配置文件,并且主机应运行Docker Engine或Docker Desktop。
As it was confirmed by AWS support, there was no 'out-of-the-box' way to do this job, other than direct mirroring of entire repository.
Thus I rewrote the tool for doing it in a smarter and faster way, and published it.
https://github.com/dfad1ripe/aws-ecr-cross-account-clone
To use it, both source and destination AWS accounts should be defined as profiles in ~/.aws/credentials, and the host should be running either Docker Engine or Docker Desktop.