【发布时间】:2021-12-09 17:56:46
【问题描述】:
在 Github Actions 上,当我将新构建的 Docker 映像保存在缓存中时,我希望避免从注册表中提取它(这是我工作中最慢的部分)
我的工作流程是这样的
- 构建映像(包含我所有的依赖项)
- 在上图中运行命令
根据Docker Build Push Action docs,将cache-to 和cache-from 设置为指向gha 有助于加快第1 步。
但是,当我运行docker run ghcr.io/org/image:new-tag command 时,它总是以
Unable to find image 'ghcr.io/org/image:new-tag' locally
new-tag: Pulling from org/image
...
5402d6c1eb0a: Pulling fs layer
...
大约需要 50 秒(总工作时间约为 75 秒)。
当存在包含此信息的缓存时,这似乎是不必要的,但是我不知道如何告诉我的 docker run 命令如何使用此缓存,据我所知,没有--cache-from=gha docker run 的等效选项。
当我在 Github Actions 上调用 docker run 时,如何告诉 docker 在 gha 缓存中查找图像?
【问题讨论】:
标签: docker caching continuous-integration github-actions buildx