Can I build docker images if the action runner is a docker instance

I am trying to use a Gitea installation to build an docker image from my project, which is currently limited to a runs-on: docker worker. I assume that this requires a Docker-in-docker image, but then it needs to connect to the host Docker service and that apparently does not work.

Currently I am trying to run docker info with

on: [push]
jobs:
  build:
    runs-on: docker
    container: 
        image: docker:dind
    steps:
      - run: docker info

and that complains that the .sock file is not accessible.

You either run a Docker-in-Docker service, or you mount the host’s Docker socket.

Another option is to use something like Kaniko, that will not require granting scary permissions to the build: GitHub - GoogleContainerTools/kaniko: Build Container Images In Kubernetes GitLab has an example for their CI which you should be able to translate easily enough: Use kaniko to build Docker images | GitLab

honestly … i just created act-runner docker image(from the base one) which included, docker-in-docker installation and coz it is alpine based, really easy to achieve:

apk --no-cache add docker docker-compose
  • modify a bit entrypoint.sh with something like:
....
echo "Starting docker daemon ..."
dockerd 1>/dev/null 2>&1 &
...

As the downside, such runner requires privileged mode …