How to upload docker image to AWS using github actions self-hosted runner

814 views Asked by At

Trying to run the workflow below, but when it tries to login into AWS it fails. Doesn't seem to be able to find docker:

/bin/docker exec 3a35b843bb4193a520ad9466e6f4ed6308bd01564cb0e7f38ac5976249bb94a4 sh -c "cat /etc/*release | grep ^ID" ##[error]Unable to locate executable file: docker. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.

Our self-hosted runners are VMs, which have docker installed, and the container is based on python:3.8-alpine. Can anybody tell me how do I run docker commands inside a self-hosted runner, using container? Mounting the docker socket volume or not, the error is the same.

name: Deploy to Stage

on:
  pull_request:
    types: [closed]
    branches:
      - dev
  push:
    branches:
      - feat-k8s

jobs:
  DeployToStage:
    runs-on: self-hosted
    container:
      image: edlut/azion:monster-python3
      options: --privileged
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock

    steps:
      - uses: actions/checkout@v2

      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.ECR_ID }}
          aws-secret-access-key: ${{ secrets.ECR_KEY }}
          aws-region: us-east-1

      - name: Login to Amazon ECR 
        id: login-ecr
        uses: aws-actions/amazon-ecr-login@v1

      - name: Build and push Docker images
        uses: docker/build-push-action@v1
        with:
          registry: ${{ steps.login-ecr.outputs.registry }}
          repository: 112233445566.dkr.ecr.us-east-1.amazonaws.com/monster-processor
          tags: ${{ github.sha }}
0

There are 0 answers