I created a workflow on a Github Enterprise server. I want to build & push the container with the docker/build-push-action and before push I want to run some tests in the container.
My Workflow file looks like this:
name: Docker Image Build & Push
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
build:
name: Build & Push Container
runs-on: [self-hosted, linux, docker]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker Meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
registry.private/user/image
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
- name: Login to Registry
uses: docker/login-action@v3
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: registry.private
- name: Docker Build
uses: docker/build-push-action@v5
with:
push: false
context: .devcontainer
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Run some commands in the container
uses: addnab/docker-run-action@v3
with:
image: registry.private/user/image
run: whoami && pwd
# Put here the step for the push
Everything works fine except the execution of the addnab/docker-run-action@v3 action. I got the following error message:
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
I found following issue on Github, but there was also no working solution.