1

I want to create a GitHub Action that uses docker and want to run it locally using act. When I execute the act command, I get the following error: 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.`

I use the following files to build the action:

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

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

  1. 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: "."

The files are arranged in the .github folder in the following way:

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

Even though I executed the docker login command and got: Authenticating with existing credentials...Login Succeeded, I'm getting the same error over and over again. Do I need to auth act in any specific way?

EDIT: Some extra info after having analysed the logs.

When I analyze the act logs, I can see some strange behavior. After some initialization steps, act builds an image from my docker file, which is quite typical: docker build -t act-github-actions-dockeraction:latest repo/.github/actions.
Surprisingly, it then tries to pull this image instead of running it directly: docker pull image=act-github-actions-dockeraction:latest platform= username=*** forcePull=true. Since it has just built the image locally, no wonder it is not accessible via a pull from the docker hub (is it the docker hub, actually?).
The question is, how to make it run the image directly?

SkogensKonung
  • 601
  • 1
  • 9
  • 22
  • What is your question? It reads like there was an error and then it was fixed by running the `docker login` command. Forgot to add the rest? – Azeem Feb 26 '23 at 15:06
  • Editied and clarified. – SkogensKonung Feb 26 '23 at 15:40
  • Thanks! Is `act-github-actions-dockeraction` a private repo? – Azeem Feb 26 '23 at 15:56
  • I thought this is an act-related image needed to run a Docker container GitHub Action locally and would presume it was public. – SkogensKonung Feb 26 '23 at 15:57
  • Right. [Searching on the docker hub doesn't give any results](https://hub.docker.com/search?q=act-github-actions-dockeraction&type=image). So, I'm assuming that it's private and that login is required. What happens if you specify the version for that `alpine` image? – Azeem Feb 26 '23 at 16:03
  • See https://stackoverflow.com/questions/48719921/pull-access-denied-repository-does-not-exist-or-may-require-docker-login. – Azeem Feb 26 '23 at 16:05
  • Unfortunately, specifying the version of the alpine image does not help. I will check out the link you sent. – SkogensKonung Feb 26 '23 at 16:11
  • Oddly enough, I can see this image in my Docker Desktop. – SkogensKonung Feb 26 '23 at 16:15
  • I've just checked out the responses in the thread you provided a link to, and none of the presented solutions helped. I logged out and logged in again; I have the image locally, i.e., `docker image ls` shows it. Do you have any other idea why it does not work? Have you tried running act at your computer? Did you execute any further auth steps? – SkogensKonung Feb 26 '23 at 18:00
  • Right. No, I did not. If you have this in a public repo, please include its link in your question. I'll try to test it on my side. Thanks! – Azeem Feb 27 '23 at 03:54
  • `docker image ls` might be showing the image because you already have it downloaded after `docker login`. – Azeem Feb 27 '23 at 03:55
  • I edited the post and added some extra info about the logs. I would like to ask you to run the action with a docker file locally with act and report what is happening on your side. Does `act` also try to pull the image instead of running it directly? – SkogensKonung Feb 27 '23 at 07:29
  • Thanks! By "**`act` also try to pull the image instead of running it directly**", do you mean using the host's machine's already pulled docker images? – Azeem Feb 27 '23 at 07:50
  • I was watching a tutorial where a person used an older version of `act` to run GitHub actions locally. I observed the logs when he ran `act`. On his computer, `act` first built the image from the local Dockerfile (same as with me), but then it ran the newly created image directly, whereas my `act` version tries to pull the freshly made image from no one knows where. I'd like to know why it wants to pull it instead of running it. – SkogensKonung Feb 27 '23 at 08:19
  • `alpine` image? What happens if you mention a specific version? – Azeem Feb 27 '23 at 10:18
  • 2
    Ok, the problem is solved. You have to manually disable the force pull that act does by default, i.e. run your command with `-p=false`. Thanks for your willingness to help anyways :) – SkogensKonung Feb 27 '23 at 17:53
  • @RobertSzooba Thanks for sharing the fix. Did you know you can [answer your own question](https://stackoverflow.com/help/self-answer) on Stack Overflow if you find the answer? Would you mind posting it as an answer so it's easier for others to find? – jamesmortensen May 06 '23 at 12:53

0 Answers0