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

使用act本地运行Docker容器型GitHub Action时拉取镜像报错求助

解决act本地运行Docker GitHub Action时的拉取镜像错误

在本地使用act工具运行自定义Docker GitHub Action时,出现以下错误:

Error response from daemon: pull access denied for act-github-actions-dockeraction, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

即使执行docker login并提示登录成功,错误仍然反复出现。查看act日志发现,工具会先从本地Dockerfile构建镜像:

docker build -t act-github-actions-dockeraction:latest repo/.github/actions

但随后会尝试从Docker Hub拉取该镜像:

docker pull image=act-github-actions-dockeraction:latest platform= username=*** forcePull=true

由于镜像仅存在于本地,导致拉取失败。


使用的文件内容

1. Dockerfile

FROM alpine
RUN apk add --no-cache jq
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

2. .github/actions/action.yml

name: test 
description: test
runs:
  using: docker
  image: Dockerfile
inputs:
  jq_selector:
    description: "The jq selector to execute"
    required: false
    default: '.'

3. .github/workflows/show_event.yml

name: shows event with jq selector
on:
  push:
    branches: [main]
jobs:
  output-debug:
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: where am i
        run: pwd

      - name: my custom action
        uses: ./.github/actions 
        with:
          jq_selector: "."

目录结构

├── .github
│   ├── actions
│   │   ├── Dockerfile
│   │   ├── action.yaml
│   │   └── entrypoint.sh
│   └── workflows
│       └── show_event.yml

解决方法

运行act时添加--no-pull参数,强制工具使用本地已构建的镜像,不再尝试从远程仓库拉取:

act --no-pull

或者使用更明确的参数形式:

act --pull=false

这个参数会告诉act跳过镜像拉取步骤,直接使用本地构建好的act-github-actions-dockeraction:latest镜像运行Action。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.30 05:37:43