Home > Net >  GitHub Action Error: Docker pull failed with exit code 1
GitHub Action Error: Docker pull failed with exit code 1

Time:12-15

I'm trying to run my npm build inside the docker container using our private docker image with GitHub actions.

My Workflow yaml file as follows,

jobs:
  build:
    runs-on: Linux-self-hosted  # This is our self hosted linux runner system.
    container:
      image: ubuntu-20.04-lts:latest  # This is our private docker image.

    steps:
    - name: Checkout Repository
      uses: actions/checkout@v2
      
    - name: Npm Build
      run: npm install

    - name: Build Package
      run: vsce package

GitHub Action Error:-

Starting job container /usr/bin/docker pull ubuntu-20.04-lts:latest Error response from daemon: pull access denied for ubuntu-20.04-lts, repository does not exist or may require 'docker login': denied: requested access to the resource is denied Warning: Docker pull failed with exit code 1, back off 4.74 seconds before retry.
/usr/bin/docker pull ubuntu-20.04-lts:latest Error response from daemon: pull access denied for ubuntu-20.04-lts, repository does not exist or may require 'docker login': denied: requested access to the resource is denied Warning: Docker pull failed with exit code 1, back off 9.535 seconds before retry. /usr/bin/docker pull ubuntu-20.04-lts:latest Error response from daemon: pull access denied for ubuntu-20.04-lts, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
Error: Docker pull failed with exit code 1

i have this ubuntu-20.04-lts:latest private docker image on my host system locally. Still it fails with above error during action build.

It looks trying to connect docker hub. How do i fix this to use our local private image?

CodePudding user response:

You'll have to push your image to your private registry. Once it is there, you can configure the credentials for your private registry as described in the docs:

container:
  image: ghcr.io/owner/image
  credentials:
     username: ${{ github.actor }}
     password: ${{ secrets.ghcr_token }}
  • Related