You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GitHub Marketplace Action引用ghcr.io镜像报错及配置咨询

问题排查与解决方案

核心错误修复

错误提示should be either '[path]/Dockerfile' or 'docker://image[:tag]'的直接原因是远程镜像格式不规范:

  • 当using: 'docker'时,引用远程容器镜像必须添加docker://协议前缀,GitHub Actions才会识别这是远程镜像资源,而非本地Dockerfile路径。

修改action.yml的runs段为:

runs: 
  using: 'docker'
  image: 'docker://ghcr.io/repository/image_name:main'

额外必要检查项

1. 镜像公开权限验证

确认ghcr.io上的目标镜像已设置为公开可见:

  • 进入该镜像的ghcr页面,在「Package settings」中将可见性切换为Public,否则组织外仓库调用时会触发权限拒绝错误。

2. 配置语法修正

排查两处语法问题:

  • action.yml中第10行description缩进错误,需与input_name的子项对齐:
    inputs:
      input_name:
        description: URL
        required: true
        default: 'https://url.com' 
    
  • 测试用workflow中with的缩进错误,需与uses同级:
    - name: My Action
      uses: public-repo/image_name@v1
      with:
        url: 'https://url.com'
    

3. 镜像标签优化建议

优先使用固定版本标签(如v1)而非分支标签(如main),避免镜像更新导致Action行为不可控。

内容的提问来源于stack exchange,提问作者36f

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 13:50:21