Failed to run job about docker action #63

Closed
opened 2023-03-21 09:13:45 +00:00 by seepine · 7 comments
Contributor

example yml

name: Gitea Actions Demo
on: [push]
jobs:
  Gitea-Actions:
    runs-on: ubuntu-latest
    steps:

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v2

      - name: Set up Docker BuildX
        uses: docker/setup-buildx-action@v2

image

act_runner log

[Gitea Actions Demo/Gitea-Actions] [DEBUG] Working directory '/root/gitea'
[Gitea Actions Demo/Gitea-Actions]   ❓  ::group::Docker info
[Gitea Actions Demo/Gitea-Actions]   ❓  ::endgroup::
[Gitea Actions Demo/Gitea-Actions]   ❗  ::error::Unable to locate executable file: docker. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
[Gitea Actions Demo/Gitea-Actions]   ❌  Failure - Main Set up QEMU
[Gitea Actions Demo/Gitea-Actions] exitcode '1': failure

image

example yml ```yml name: Gitea Actions Demo on: [push] jobs: Gitea-Actions: runs-on: ubuntu-latest steps: - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker BuildX uses: docker/setup-buildx-action@v2 ``` ![image](/attachments/1e0195d0-ea0c-41a0-8afb-502cbd2e933b) act_runner log ``` [Gitea Actions Demo/Gitea-Actions] [DEBUG] Working directory '/root/gitea' [Gitea Actions Demo/Gitea-Actions] ❓ ::group::Docker info [Gitea Actions Demo/Gitea-Actions] ❓ ::endgroup:: [Gitea Actions Demo/Gitea-Actions] ❗ ::error::Unable to locate executable file: docker. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable. [Gitea Actions Demo/Gitea-Actions] ❌ Failure - Main Set up QEMU [Gitea Actions Demo/Gitea-Actions] exitcode '1': failure ``` ![image](/attachments/a35a1428-aecd-469f-9006-1b2b2ae5981e)
Owner

There is no docker installed in the ubuntu-latest the default image. You need to install docker as first step.

There is no docker installed in the ubuntu-latest the default image. You need to install docker as first step.

I created an quick and dirty action that installs the docker-ce-cli package for you.

But this is really a communication/documentation issue. The post announcing this feature links directly to the github documentation page. Following examples there people will hit at least two pitfalls:

  1. Execution base images are not same. This can cause many runtime errors when attempting to use community actions, though subtle actions on github are actually executed in Ubuntu based images. This runner will execute in debian based images.

  2. Using actions from the github marketplace is possible but the names have to be prefixed with https://github.com ie my published docker install action: https://github/papodaca/install-docker-action@v1

It is actually really weird that for this runner ubuntu-latest means debian buster. I understand why this is, the project this was forked from used that execution image as well.

I created an quick and dirty [action](https://git.au.iyg.im/papodaca/install-docker-action) that installs the docker-ce-cli package for you. But this is really a communication/documentation issue. The post announcing this feature links directly to the [github documentation page](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions). Following examples there people will hit at least two pitfalls: 1. Execution base images are not same. This can cause many runtime errors when attempting to use community actions, though subtle actions on github are actually executed in Ubuntu based images. This runner will execute in [debian based images](https://github.com/nektos/act/blob/master/IMAGES.md). 2. Using actions from the github marketplace is possible but the names have to be prefixed with `https://github.com` ie my published docker install action: `https://github/papodaca/install-docker-action@v1` It is actually really weird that for this runner `ubuntu-latest` means debian buster. I understand why this is, the project this was forked from used that execution image as well.
Author
Contributor

Yeah, act_runner use node:16-bullseye as default container, so need to install docker in steps.
And appoint container can work also, like

jobs:
  build-image:
    runs-on: ubuntu-latest
    container: catthehacker/ubuntu:act-latest

I am wondering if it's necessary to have the default container support docker like github runner, although the size has increased, for example catthehacker/ubuntu:act-latest the size 1.15GB, and node:16-bullseye the size 941MB

The 200MB gap seems acceptable

Yeah, act_runner use `node:16-bullseye` as default container, so need to install docker in steps. And appoint container can work also, like ```yml jobs: build-image: runs-on: ubuntu-latest container: catthehacker/ubuntu:act-latest ``` I am wondering if it's necessary to have the default container support docker like github runner, although the size has increased, for example `catthehacker/ubuntu:act-latest` the size `1.15GB`, and `node:16-bullseye` the size `941MB` The 200MB gap seems acceptable

Alternatively, if you don't want to install docker every time your action runs, you can build your own runner image.

To do so, I used catthehacker's ubuntu image and installed docker on top of it using the following Dockerfile:

FROM ghcr.io/catthehacker/ubuntu:custom-22.04
RUN curl -fsSL https://get.docker.com -o get-docker.sh
RUN sh get-docker.sh

Build and tag the image. I used my own private container registry to store the image but it should be possible to just leave the image locally on the machine that your gitea act_runner executable lives on.

The resulting image has a size of ~2.3GB. If you're concerned about image size you can, instead of using catthehacker's image as base, use any container image (e.g. debian) and you even should be able to simply use one of docker's docker containers as runner image right away, but I did not test this.

After running the act_runner executable for the first time, there is a .runner file in the same directory that the executable is in.

Inside this file you'll find an array called labels.
Add a new label (in my case ci-docker) and specify your image like seen below and restart the executable.

  "labels": [
    "ubuntu-latest:docker://node:16-bullseye",
    "ubuntu-22.04:docker://node:16-bullseye",
    "ubuntu-20.04:docker://node:16-bullseye",
    "ubuntu-18.04:docker://node:16-buster",
    "ci-docker:docker://registry.int.domain.tld/ci/ubuntu-docker:latest"
  ]

In Gitea admin panel add the label name you just specified in the .runner file to your runner as a custom label. The runner you add this label to has to have access to the image you just built.

add custom label

You can now use the image in your workflows referencing the custom label in the runs-on key:

jobs:
  build:
    runs-on: ci-docker
Alternatively, if you don't want to install docker every time your action runs, you can build your own runner image. To do so, I used [catthehacker's ubuntu image](https://github.com/catthehacker/docker_images/pkgs/container/ubuntu) and installed docker on top of it using the following Dockerfile: ``` FROM ghcr.io/catthehacker/ubuntu:custom-22.04 RUN curl -fsSL https://get.docker.com -o get-docker.sh RUN sh get-docker.sh ``` Build and tag the image. I used my own private container registry to store the image but it should be possible to just leave the image locally on the machine that your gitea ```act_runner``` executable lives on. The resulting image has a size of ~2.3GB. If you're concerned about image size you can, instead of using catthehacker's image as base, use any container image (e.g. debian) and you even should be able to simply use one of [docker's docker containers](https://hub.docker.com/_/docker) as runner image right away, but I did not test this. After running the ```act_runner``` executable for the first time, there is a ```.runner``` file in the same directory that the executable is in. Inside this file you'll find an array called ```labels```. Add a new label (in my case ```ci-docker```) and specify your image like seen below and restart the executable. ``` "labels": [ "ubuntu-latest:docker://node:16-bullseye", "ubuntu-22.04:docker://node:16-bullseye", "ubuntu-20.04:docker://node:16-bullseye", "ubuntu-18.04:docker://node:16-buster", "ci-docker:docker://registry.int.domain.tld/ci/ubuntu-docker:latest" ] ``` In Gitea admin panel add the label name you just specified in the ```.runner``` file to your runner as a custom label. The runner you add this label to has to have access to the image you just built. ![add custom label](/attachments/5d966a04-b83a-4c86-9a5c-ee6fc1fb6e81) You can now use the image in your workflows referencing the custom label in the ```runs-on``` key: ``` jobs: build: runs-on: ci-docker ```

Is there any reason why docker isn't installed by default in the ubuntu-latest image? It seems you want to try to be similar to GitHub actions, and the resources I found when looking up this issue mentioned that docker is installed by default on the ubuntu image. Seems logical to make the image as close as possible as well to promote the transfer-ability of GitHub actions to Gitea actions.

Is there any reason why docker isn't installed by default in the ubuntu-latest image? It seems you want to try to be similar to GitHub actions, and the resources I found when looking up this issue mentioned that docker is installed by default on the ubuntu image. Seems logical to make the image as close as possible as well to promote the transfer-ability of GitHub actions to Gitea actions.
Owner

Is there any reason why docker isn't installed by default in the ubuntu-latest image?

We just hope to use a small image to run jobs, not everyone likes waiting to download big images. See also https://github.com/nektos/act#runners

It seems you have found the cause of the problem, so I will close this issue.

Feel free to reopen it if you have any other questions.

> Is there any reason why docker isn't installed by default in the ubuntu-latest image? We just hope to use a small image to run jobs, not everyone likes waiting to download big images. See also https://github.com/nektos/act#runners It seems you have found the cause of the problem, so I will close this issue. Feel free to reopen it if you have any other questions.

Yeah, act_runner use node:16-bullseye as default container, so need to install docker in steps.
And appoint container can work also, like

jobs:
  build-image:
    runs-on: ubuntu-latest
    container: catthehacker/ubuntu:act-latest

I am wondering if it's necessary to have the default container support docker like github runner, although the size has increased, for example catthehacker/ubuntu:act-latest the size 1.15GB, and node:16-bullseye the size 941MB

The 200MB gap seems acceptable

I agree with your opinion. Further more, you could offer different runner image choices, for example standard image containers git and docker as default one, and slimmer image which doesn't. Experts would be left with choices for their own, if size does matters.

> Yeah, act_runner use `node:16-bullseye` as default container, so need to install docker in steps. > And appoint container can work also, like > ```yml > jobs: > build-image: > runs-on: ubuntu-latest > container: catthehacker/ubuntu:act-latest > ``` > > I am wondering if it's necessary to have the default container support docker like github runner, although the size has increased, for example `catthehacker/ubuntu:act-latest` the size `1.15GB`, and `node:16-bullseye` the size `941MB` > > The 200MB gap seems acceptable I agree with your opinion. Further more, you could offer different runner image choices, for example standard image containers git and docker as default one, and slimmer image which doesn't. Experts would be left with choices for their own, if size does matters.
Sign in to join this conversation.
No Milestone
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: gitea/act_runner#63
No description provided.