Use docker and docker compose inside the action

I absolutely adore the functionality in Gitea that allows for the integration of GitHub Actions within the Gitea workflow.

I have also observed a substantial use of Docker within my CI (Continuous Integration) workflows, which significantly simplifies the process of building and modifying the CI pipeline.

Having successfully configured my Gitea workflows to run within my GitHub Actions CI setup, I find myself puzzled by my inability to execute Docker commands within this environment.

Consistently, I encounter the following error:

/var/run/act/workflow/1: line 3: docker: command not found

and my configuration is really simple

name: Integration testing

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
  schedule:
    - cron: '30 1 1,15 * *'

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Integration testing
        run: |
          cd docker
          docker compose up --exit-code-from lampo

Because on ubuntu-latest, there is no docker installed. You need to install docker before invoke it or you can use an docker-in-docker image.

Why on the github one this works? It is a different image?

Github will run the tasks on a real virtual machine. Gitea Actions has a different implementation from GitHub Actions, but the workflow syntax is the same.

Could you elaborate on how to install docker in the runner or could I just mount it from the host somehow? What would be the best way to approach this? I would also like to deploy the final result with docker stack/compose (on the same physical machine… I know)

A good example demonstrating the use of docker inside Gitea Actions comes from the gitea repository itself:

Key is the container.image, where the catthehacker/ubuntu:act-latest seems to have docker accessible, so that you can set it up using the action docker/setup-buildx-action. I still have to investigate a bit, to understand the details (e.g. why is it container.image: and not container: as I would expect from the Github Actions docs).

However this example was a starter for my functioning action to build a docker image.