【问题标题】:Act Not able to Use Docker APIAct 无法使用 Docker API
【发布时间】:2021-11-21 15:46:18
【问题描述】:

我正在尝试使用开源 Act 实用程序在本地测试 github 操作。

“全局思考,act 本地化”

我已经复制了要检查 github 操作的 git hub 存储库,它确实包含 .github/workflow 文件夹。
我运行这个命令来运行我的 github 操作。

act -v workflow_dispatch

它给出了这个错误

DEBU[0000] Loading environment from /home/harshal/harshal/open-horizon.github.io/.env 
DEBU[0000] Loading secrets from /home/harshal/harshal/open-horizon.github.io/.secrets 
DEBU[0000] Loading workflows from '/home/harshal/harshal/open-horizon.github.io/.github/workflows' 
DEBU[0000] Loading workflows recursively                
DEBU[0000] Found workflow 'anaxdocscopy.yml' in '/home/harshal/harshal/open-horizon.github.io/.github/workflows/anaxdocscopy.yml' 
DEBU[0000] Found workflow 'link-snitch.yml' in '/home/harshal/harshal/open-horizon.github.io/.github/workflows/link-snitch.yml' 
DEBU[0000] Reading workflow '/home/harshal/harshal/open-horizon.github.io/.github/workflows/anaxdocscopy.yml' 
DEBU[0000] Correcting if statements '/home/harshal/harshal/open-horizon.github.io/.github/workflows/anaxdocscopy.yml' 
DEBU[0000] Reading workflow '/home/harshal/harshal/open-horizon.github.io/.github/workflows/link-snitch.yml' 
DEBU[0000] Correcting if statements '/home/harshal/harshal/open-horizon.github.io/.github/workflows/link-snitch.yml' 
DEBU[0000] Planning event: workflow_dispatch            
DEBU[0000] Loading slug from git directory '/home/harshal/harshal/open-horizon.github.io/.git' 
DEBU[0000] Found revision: a632f3efe8b7c29bc69794bcbf1f6ecd323467f0 
DEBU[0000] Loading revision from git directory '/home/harshal/harshal/open-horizon.github.io/.git' 
DEBU[0000] Found revision: a632f3efe8b7c29bc69794bcbf1f6ecd323467f0 
DEBU[0000] HEAD points to 'a632f3efe8b7c29bc69794bcbf1f6ecd323467f0' 
DEBU[0000] using github ref: refs/heads/master          
DEBU[0000] context env => map[ACT:true ISSUE_TEMPLATE:.github/ISSUE_TEMPLATE/check-broken-links.md URL:https://open-horizon.github.io/] 
DEBU[0000] context needs => map[]                       
[Link Snitch/build] ????  Start image=catthehacker/ubuntu:act-latest
DEBU[0000] Loading slug from git directory '/home/harshal/harshal/open-horizon.github.io/.git' 
DEBU[0000] Found revision: a632f3efe8b7c29bc69794bcbf1f6ecd323467f0 
DEBU[0000] Loading revision from git directory '/home/harshal/harshal/open-horizon.github.io/.git' 
DEBU[0000] Found revision: a632f3efe8b7c29bc69794bcbf1f6ecd323467f0 
DEBU[0000] HEAD points to 'a632f3efe8b7c29bc69794bcbf1f6ecd323467f0' 
DEBU[0000] using github ref: refs/heads/master          
[Link Snitch/build]   ????  docker pull catthehacker/ubuntu:act-latest
DEBU[0000] FIXME: Got an status-code for which error does not match any expected type!!!: -1  module=api status_code=-1
DEBU[0000] Image exists? false                          
DEBU[0000] Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/json?filter=catthehacker%2Fubuntu%3Aact-latest": dial unix /var/run/docker.sock: connect: permission denied
unable to determine if image already exists for image "catthehacker/ubuntu:act-latest" () 
DEBU[0000] Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/json?filter=catthehacker%2Fubuntu%3Aact-latest": dial unix /var/run/docker.sock: connect: permission denied
unable to determine if image already exists for image "catthehacker/ubuntu:act-latest" () 
DEBU[0000] Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/json?filter=catthehacker%2Fubuntu%3Aact-latest": dial unix /var/run/docker.sock: connect: permission denied
unable to determine if image already exists for image "catthehacker/ubuntu:act-latest" () 
DEBU[0000] Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/json?filter=catthehacker%2Fubuntu%3Aact-latest": dial unix /var/run/docker.sock: connect: permission denied
unable to determine if image already exists for image "catthehacker/ubuntu:act-latest" () 
DEBU[0000] Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/json?filter=catthehacker%2Fubuntu%3Aact-latest": dial unix /var/run/docker.sock: connect: permission denied
unable to determine if image already exists for image "catthehacker/ubuntu:act-latest" () 
DEBU[0000] Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/json?filter=catthehacker%2Fubuntu%3Aact-latest": dial unix /var/run/docker.sock: connect: permission denied
unable to determine if image already exists for image "catthehacker/ubuntu:act-latest" () 
DEBU[0000] Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/json?filter=catthehacker%2Fubuntu%3Aact-latest": dial unix /var/run/docker.sock: connect: permission denied
unable to determine if image already exists for image "catthehacker/ubuntu:act-latest" () 
DEBU[0000] Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/json?filter=catthehacker%2Fubuntu%3Aact-latest": dial unix /var/run/docker.sock: connect: permission denied
unable to determine if image already exists for image "catthehacker/ubuntu:act-latest" () 
DEBU[0000] Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/json?filter=catthehacker%2Fubuntu%3Aact-latest": dial unix /var/run/docker.sock: connect: permission denied
unable to determine if image already exists for image "catthehacker/ubuntu:act-latest" () 
DEBU[0000] Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/json?filter=catthehacker%2Fubuntu%3Aact-latest": dial unix /var/run/docker.sock: connect: permission denied
unable to determine if image already exists for image "catthehacker/ubuntu:act-latest" () 
DEBU[0000] Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/json?filter=catthehacker%2Fubuntu%3Aact-latest": dial unix /var/run/docker.sock: connect: permission denied
unable to determine if image already exists for image "catthehacker/ubuntu:act-latest" () 
Error: unable to determine if image already exists for image "catthehacker/ubuntu:act-latest" (): Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/json?filter=catthehacker%2Fubuntu%3Aact-latest": dial unix /var/run/docker.sock: connect: permission denied

我是 docker 新手,我对它一无所知,只是它为运行软件创建容器(类似于操作系统)。我尝试在 github 问题上搜索 Act 但找不到任何东西。
我用sudo snap install docker 安装了docker,然后我检查了echo $?,它给出了0docker -v,它给出了Docker version 20.10.8, build 3967b7d28e,所以看起来我确实安装了运行docker,但仍然为什么它会给出这个错误。
这是我编写的 github 操作/工作流文件

name: Link Snitch

on:
  schedule:
    - cron:  '0 1 1 * *'
  workflow_dispatch:
  
 
env:
  URL: https://open-horizon.github.io/
  ISSUE_TEMPLATE: ".github/ISSUE_TEMPLATE/check-broken-links.md"

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - name: Check out master
        uses: actions/checkout@master
        with:
          fetch-depth: 1

      - name: Report broken links
        uses: victoriadrake/link-snitch@master
        with:
          Resursive urls: true
          URL: https://open-horizon.github.io/

        if: ${{ failure() }}
      - uses: JasonEtco/create-an-issue@v2.4.0
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          filename: ${{ env.ISSUE_TEMPLATE }}
        if: ${{ failure() }}

【问题讨论】:

    标签: docker github-actions docker-api building-github-actions


    【解决方案1】:

    我仍然不知道 act 不起作用的原因。

    但是当我以 root 权限运行相同的命令时,它可以工作,所以我想它正在尝试做一些需要 root 授权的事情。如果有人可以对此进行扩展,那将很有帮助,谢谢。

    【讨论】:

    • OP 如何发布他们为解决问题所做的工作而不是对他们提出的问题的回答?
    • @novonimo Not An Answer (NAA) 和不好的答案是有区别的。如果您认为这是后者,您可以对答案投反对票,但这里建议删除不是合适的操作。
    猜你喜欢
    • 2019-09-17
    • 1970-01-01
    • 2019-12-12
    • 1970-01-01
    • 2017-02-19
    • 1970-01-01
    • 1970-01-01
    • 2021-09-12
    • 1970-01-01
    相关资源
    最近更新 更多