RafikFarhad / push-to-gcr-github-action

An action that build docker image and push to Google Cloud Registry and Google Artifact Registry.
MIT License
68 stars 37 forks source link

facing problems with your workflow while using on self-hosted machine #14

Closed mhs-achyut closed 3 years ago

mhs-achyut commented 3 years ago

@RafikFarhad please find the error log below

Build container for action use: '/home/runner/_work/_actions/RafikFarhad/push-to-gcr-github-action/v3.0.2/Dockerfile'.
  /usr/bin/docker build -t b1cbc5:ae9ded0717024df4a4ae6bf782f1e1a6 -f "/home/runner/_work/_actions/RafikFarhad/push-to-gcr-github-action/v3.0.2/Dockerfile" "/home/runner/_work/_actions/RafikFarhad/push-to-gcr-github-action/v3.0.2"
  Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
  Warning: Docker build failed with exit code 1, back off 4.836 seconds before retry.
  /usr/bin/docker build -t b1cbc5:ae9ded0717024df4a4ae6bf782f1e1a6 -f "/home/runner/_work/_actions/RafikFarhad/push-to-gcr-github-action/v3.0.2/Dockerfile" "/home/runner/_work/_actions/RafikFarhad/push-to-gcr-github-action/v3.0.2"
  Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
  Warning: Docker build failed with exit code 1, back off 5.54 seconds before retry.
  /usr/bin/docker build -t b1cbc5:ae9ded0717024df4a4ae6bf782f1e1a6 -f "/home/runner/_work/_actions/RafikFarhad/push-to-gcr-github-action/v3.0.2/Dockerfile" "/home/runner/_work/_actions/RafikFarhad/push-to-gcr-github-action/v3.0.2"
  Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Error: Docker build failed with exit code 1

@RafikFarhad please find the yaml file below:

name: build-and-push-to-gcr
on:
  push:
    branches:
    - master
    - dockerized_build
    tags:
    - '*'

env:
  PROJECT_ID: ${{ secrets.GCLOUD_PROJECT_ID }}
  SERVICE_NAME: rsi_6_axis

jobs:
  build-and-push-to-gcr:
    runs-on: [self-hosted,cml,gpu]
    steps:

      - uses: actions/checkout@v2
        with:
          submodules: recursive
      - name: Get the version
        id: get_tag_name
        run: echo ::set-output name=GIT_TAG_NAME::${GITHUB_REF/refs\/tags\//}
      - uses: RafikFarhad/push-to-gcr-github-action@v3.0.2
        with:
          gcloud_service_key: ${{ secrets.GCLOUD_SERVICE_KEY }}
          registry: gcr.io
          project_id: ${{ secrets.GCLOUD_PROJECT_ID }}
          image_name: rsi_6_axis
          image_tag: ${{ steps.get_tag_name.outputs.GIT_TAG_NAME}}
          dockerfile: ./Dockerfile
RafikFarhad commented 3 years ago

Hi @mhs-achyut , thanks for using this action. From the log, I can conclude that, this is an issue with the Github Action Runner machine. The runner machine docker command can not find the unix:///var/run/docker.sock and thats why it is failing. Could you try re-running the job?

mhs-achyut commented 3 years ago

no luck, it is the same problem. I restarted the host machine, restarted the docker service, and also restarted the jobs. But with no luck. I can see the docker service active:

sudo systemctl status docker [sudo] password for administrator:  ● docker.service - Docker Application Container Engine      Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)      Active: active (running) since Mon 2021-06-07 17:01:39 EDT; 29min ago TriggeredBy: ● docker.socket        Docs: https://docs.docker.com    Main PID: 1800 (dockerd)       Tasks: 21      Memory: 199.5M      CGroup: /system.slice/docker.service              └─1800 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
mhs-achyut commented 3 years ago

I was using iterative/cml repo for my runners. Anyways, if I use a native machine instead of docker, this action works. FYI, for anyone who might stumble here in the future.