Hello,
I’ve been trying to build and push a container image from one of my repositories using Gitea Actions, but I’m having trouble running Docker’s actions, or rather, anything involving the Docker socket.
This is supposedly a working example, but I’ve tried applying its steps in my example and I get this error:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
My workflow code:
name: Build and push container image
run-name: ${{ gitea.actor }} is building and pushing container image
on: create
env:
GITEA_DOMAIN: git.mydomain.com
GITEA_REGISTRY_USER: myuser
RESULT_IMAGE_NAME: owner/image
jobs:
build-and-push-image:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to registry
uses: docker/login-action@v3
with:
registry: ${{ env.GITEA_DOMAIN }}
username: ${{ env.GITEA_REGISTRY_USER }}
password: ${{ secrets.CONTAINER_REGISTRY_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ env.GITEA_DOMAIN }}/${{ env.RESULT_IMAGE_NAME }}:${{ gitea.ref }}
I’ve tried mounting the runner’s Docker socket but to no avail. Is this something specific to containerized act runners and if so how do I fix it? Any help is much appreciated.