Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

insufficient_scope: authorization failed #987

Closed
2 of 3 tasks
Yucked opened this issue Oct 11, 2023 · 3 comments
Closed
2 of 3 tasks

insufficient_scope: authorization failed #987

Yucked opened this issue Oct 11, 2023 · 3 comments

Comments

@Yucked
Copy link

Yucked commented Oct 11, 2023

Contributing guidelines

I've found a bug, and:

  • The documentation does not mention anything about my problem
  • There are no open or closed issues that are related to my problem

Description

Error when pushing to ghcr.io, workflow is as follow:

   publish:
    name: Publish to GitHub
    runs-on: ubuntu-latest
    needs: build

    steps:
    - name: Checkout
      uses: actions/checkout@v4
      
    - name: Docker Login      
      uses: docker/login-action@v3
      with:
        registry: ghcr.io
        username: ${{ github.repository_owner }}
        password: ${{ secrets.GITHUB_TOKEN }}
                
    - name: Build and push Docker images
      uses: docker/build-push-action@v5
      with: 
        pull: true
        context: .
        push: true
        tags: ghcr.io/yucked/grimoire:${{ github.run_number }}  

Already tried the suggestions in #160

#3 [internal] load metadata for docker.io/library/build:latest
#3 ERROR: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
------
 > [internal] load metadata for docker.io/library/build:latest:
------
Dockerfile:4
--------------------
   2 |     RUN apk add --no-cache curl unzip
   3 |     
   4 | >>> FROM build
   5 |     RUN curl -OJL https://github.com/Yucked/Grimoire/archive/refs/heads/main.zip && \
   6 |         unzip '*.zip' && \
--------------------
ERROR: failed to solve: build: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
Error: buildx failed with: ERROR: failed to solve: build: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed

Expected behaviour

Should be able to build the image

Actual behaviour

Fails to build the image and push to github registry

Error: buildx failed with: ERROR: failed to solve: build: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed

Repository URL

https://github.com/Yucked/Grimoire

Workflow run URL

https://github.com/Yucked/Grimoire/actions/runs/6486766699/job/17615641628

YAML workflow

name: Build & Publish
on: push

jobs:
   build:
    name: Build
    runs-on: ubuntu-latest
    
    steps:
    - name: Checkout
      uses: actions/checkout@v4

    - name: Setup .NET Core SDK
      uses: actions/[email protected]
      with:
        dotnet-version: 8.x

   publish:
    name: Publish to GitHub
    runs-on: ubuntu-latest
    needs: build

    steps:
    - name: Checkout
      uses: actions/checkout@v4
      
    - name: Docker Login      
      uses: docker/login-action@v3
      with:
        registry: ghcr.io
        username: ${{ github.repository_owner }}
        password: ${{ secrets.GITHUB_TOKEN }}
                
    - name: Build and push Docker images
      uses: docker/build-push-action@v5
      with: 
        pull: true
        context: .
        push: true
        tags: ghcr.io/yucked/grimoire:${{ github.run_number }}

Workflow logs

No response

BuildKit logs

No response

Additional info

No response

@crazy-max
Copy link
Member

The error looks legit looking at your Dockerfile: https://github.com/Yucked/Grimoire/blob/79f25660b52231ff0227c08d7f67068bab46c01e/Dockerfile#L4

FROM mcr.microsoft.com/dotnet/sdk:8.0
RUN apk add --no-cache curl unzip

FROM build
RUN curl -OJL https://github.com/Yucked/Grimoire/archive/refs/heads/main.zip && \
    unzip '*.zip' && \
    mkdir app && mv Grimoire-main/* app/ && \
    rm *.zip  && rm -rf Grimoire-main

WORKDIR app
RUN dotnet restore && \
    dotnet publish -c Release -o out

WORKDIR out
ENTRYPOINT ["dotnet", "Grimoire.Web.dll"]

build image does not exist. I also repro locally with a simple docker build .

Maybe you just need to remove the line FROM build, I'm not sure.

Closing as it does not seem to be an issue with the action but your Dockerfile.

@aryangosling
Copy link

how did you solve it @Yucked ?

@Yucked
Copy link
Author

Yucked commented Mar 1, 2024

@aryangosling I overlooked the 2nd "FROM build" line 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants