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 #160

Closed
AntonioFalcao opened this issue Oct 5, 2020 · 13 comments
Closed

insufficient_scope: authorization failed #160

AntonioFalcao opened this issue Oct 5, 2020 · 13 comments

Comments

@AntonioFalcao
Copy link

@AntonioFalcao AntonioFalcao commented Oct 5, 2020

Behaviour

Steps to reproduce this issue

  1. Set up QEMU
  2. Set up Docker Buildx
  3. Login to DockerHub
  4. Build and push

Expected behaviour

Publish image to docker hub

Actual behaviour

ERROR: server message: insufficient_scope: authorization failed

Configuration

https://github.com/AntonioFalcao/Dotnet5.GraphQL3.WebApplication
https://hub.docker.com/repository/docker/antoniofalcaojr/dotnet5-graphql3-webapi

name: Push API Image

on:
  push:
    branches: master
  workflow_dispatch:

jobs:
  push_to_registry:
    name: Push Docker image to Docker Hub
    runs-on: ubuntu-latest
    steps:
      -
        name: Set up QEMU
        uses: docker/setup-qemu-action@v1
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
      -
        name: Login to DockerHub
        uses: docker/login-action@v1 
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      -
        name: Build and push
        id: docker_build
        uses: docker/build-push-action@v2
        with:
          file: ./src/Dotnet5.GraphQL3.Store.WebAPI/Dockerfile 
          push: true
          tags: antoniofalcaojf/dotnet5-graphql3-webapi:latest
      -
        name: Image digest
        run: echo ${{ steps.docker_build.outputs.digest }}

Command produced

/usr/bin/docker buildx build --tag antoniofalcaojf/dotnet5-graphql3-webapi:latest --iidfile /tmp/docker-build-push-lDmUS3/iidfile --secret id=GIT_AUTH_TOKEN,src=/tmp/docker-build-push-lDmUS3/tmp-3384-twk4xwQeuxwk --file ./src/Dotnet5.GraphQL3.Store.WebAPI/Dockerfile --push https://github.com/AntonioFalcao/Dotnet5.GraphQL3.WebApplication.git#heads/release

Logs

#33 exporting to image
#33 exporting layers
#33 exporting layers 2.4s done
#33 exporting manifest sha256:3c6a2a955932783e726461031bee8657c2ec7f2b2f239c110ba44ae58effef69 done
#33 exporting config sha256:6d39eefff02cee7c50511f16bd824957f3ef082ed60324850954a5aa3b13a5ee done
#33 pushing layers
#33 pushing layers 0.2s done
#33 ERROR: server message: insufficient_scope: authorization failed
------
 > exporting to image:
------
failed to solve: rpc error: code = Unknown desc = server message: insufficient_scope: authorization failed
Error: The process '/usr/bin/docker' failed with exit code 1
@socheatsok78
Copy link

@socheatsok78 socheatsok78 commented Oct 5, 2020

I'm having the same issues!

@crazy-max
Copy link
Member

@crazy-max crazy-max commented Oct 5, 2020

@AntonioFalcao Looks like the same issue as #162 when Git context is used. Can you use the Path context while waiting for a fix?:

name: Push API Image

on:
  push:
    branches: master
  workflow_dispatch:

jobs:
  push_to_registry:
    name: Push Docker image to Docker Hub
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      -
        name: Set up QEMU
        uses: docker/setup-qemu-action@v1
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
      -
        name: Login to DockerHub
        uses: docker/login-action@v1 
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      -
        name: Build and push
        id: docker_build
        uses: docker/build-push-action@v2
        with:
          context: .
          file: ./src/Dotnet5.GraphQL3.Store.WebAPI/Dockerfile 
          push: true
          tags: antoniofalcaojf/dotnet5-graphql3-webapi:latest
      -
        name: Image digest
        run: echo ${{ steps.docker_build.outputs.digest }}

@socheatsok78
Copy link

@socheatsok78 socheatsok78 commented Oct 5, 2020

Yes adding context: . fix the problem.

@AntonioFalcao
Copy link
Author

@AntonioFalcao AntonioFalcao commented Oct 5, 2020

Thank's @crazy-max, but i already used this approach, and had the same error.

Applying suggestion

name: Push API Image

on:
  push:
    branches: master
  workflow_dispatch:

jobs:
  push_to_registry:
    name: Push Docker image to Docker Hub
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      -
        name: Set up QEMU
        uses: docker/setup-qemu-action@v1
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
      -
        name: Login to DockerHub
        uses: docker/login-action@v1 
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      -
        name: Build and push
        id: docker_build
        uses: docker/build-push-action@v2
        with:
          context: .
          file: ./src/Dotnet5.GraphQL3.Store.WebAPI/Dockerfile 
          push: true
          tags: antoniofalcaojf/dotnet5-graphql3-webapi:latest
      -
        name: Image digest
        run: echo ${{ steps.docker_build.outputs.digest }}

Command produced

/usr/bin/docker buildx build --tag antoniofalcaojf/dotnet5-graphql3-webapi:latest --iidfile /tmp/docker-build-push-xwP62S/iidfile --file ./src/Dotnet5.GraphQL3.Store.WebAPI/Dockerfile --push .

Logs

#35 exporting to image
#35 exporting layers
#35 exporting layers 2.2s done
#35 exporting manifest sha256:a506612326c0df77c685c8ae913ca22ddb0da48dbb9a74dc8eface5c8ec96b6e
#35 exporting manifest sha256:a506612326c0df77c685c8ae913ca22ddb0da48dbb9a74dc8eface5c8ec96b6e done
#35 exporting config sha256:8508a57b7ee75695eddb38cd79e53398cf12fb5e789a0bf7c9d00a81d5367649 done
#35 pushing layers
#35 pushing layers 0.2s done
#35 ERROR: server message: insufficient_scope: authorization failed
------
 > exporting to image:
------
failed to solve: rpc error: code = Unknown desc = server message: insufficient_scope: authorization failed
Error: The process '/usr/bin/docker' failed with exit code 1

Any suggestion?

@crazy-max
Copy link
Member

@crazy-max crazy-max commented Oct 5, 2020

@AntonioFalcao Looks like antoniofalcaojf/dotnet5-graphql3-webapi is missing on Docker Hub. Is it a private repo?

@AntonioFalcao
Copy link
Author

@AntonioFalcao AntonioFalcao commented Oct 5, 2020

@AntonioFalcao Looks like antoniofalcaojf/dotnet5-graphql3-webapi is missing on Docker Hub. Is it a private repo?

It's public: https://hub.docker.com/repository/docker/antoniofalcaojr/dotnet5-graphql3-webapi

@crazy-max
Copy link
Member

@crazy-max crazy-max commented Oct 5, 2020

@AntonioFalcao So it's a typo in your workflow:

antoniofalcaojf/dotnet5-graphql3-webapi != antoniofalcaojr/dotnet5-graphql3-webapi

@AntonioFalcao
Copy link
Author

@AntonioFalcao AntonioFalcao commented Oct 5, 2020

@AntonioFalcao So it's a typo in your workflow:

antoniofalcaojf/dotnet5-graphql3-webapi != antoniofalcaojr/dotnet5-graphql3-webapi

OMG! So sorry about that! It's working now. Thanks!

lskatz added a commit to lskatz/SneakerNet that referenced this issue Oct 5, 2020
JanWichelmann added a commit to JanWichelmann/ctf4e that referenced this issue Oct 7, 2020
lskatz added a commit to lskatz/SneakerNet that referenced this issue Oct 13, 2020
* testing docker from github

* minor fix to travis-ci

* changed branch to $TRAVIS_BRANCH

* adding env variables

* adding env variables

* double checking that travis variables are set up

* double checking that travis variables are set up

* double checking that travis variables are set up

* changing from deploy tag to after_success tag

* lowercase slug

* trying to fix the build tag name

* trying to fix the build tag name

* chewbbaca with python3

* chewbbaca with python3

* debugging docker tag

* debugging docker tag

* debugging docker tag

* debugging docker tag

* debugging docker tag

* debugging docker tag

* fixing docker tag

* fixing docker login

* explicitly giving lskatz for username

* secret variable space

* trying to get secret env variables for docker login

* trying out docker caching

* Update .travis.yml

* fix "docker save"

* trying the other kind of caching

* fixed single quote

* view dockerImages.stdout

* added cache folder

* test for size of dockerImages.stdout

* from xargs to bash loop

* fixed a quote

* a quick rm cache

* Update .travis.yml

* after removing all cache

* rm cache

* checking if file exists

* rm cache

* back to normal

* Create travis-docker.yml

* Update travis-docker.yml

* Update travis-docker.yml

* docker login

* passwordless login

* docker build

* updating run commands for variable printing

* updating run commands for variable printing

* updating run commands for variable printing

* more debugging; switching build directory to HOME

* more debugging

* more debugging

* more debugging

* actions/checkout@v2

* actions/checkout on this branch

* actions/checkout on this branch

* actions/checkout on this branch

* actions/checkout on this branch

* fixed space typo

* fixed working directory during docker build

* fixed working directory during docker build

* fixing docker build

* fixing docker build

* fixing docker build

* fixing docker build

* fixing docker build

* trying docker push

* using a more appropriate env variable

* fixed case on docker tag

* moving env out of job and to global

* separating out to multiple jobs that depend on each other, in preparation for any concurrency

* some concurrency

* m

* m

* added some debugging

* m

* added init and debugging jobs

* init needs debugging

* exporting REMOTE_TAG

* figuring out variable continuity

* figuring out variable continuity

* passing outputs between jobs

* passing outputs between jobs

* passing outputs between jobs

* debugging more

* debugging more

* debugging more with JSON

* debugging more with JSON

* debugging more with JSON2

* moved git checkout to init job

* maybe I needed to do fromJSON. And moved git checkout back.

* JSON3

* JSON3

* JSON4

* JSON5

* JSON6

* test slug

* removed all underscores and dashes in this output chain

* export slug

* export slug2

* just trying to make env work at all

* env2

* env3

* making the env work properly with format()

* env2

* env3

* env4

* env5

* env6

* trying things out

* trying things out

* trying things out

* trying things out

* trying things out

* just making the variables work

* docker cache action

* docker cache action

* Trying to follow satackey more closely

* Update travis-docker.yml

* added docker login

* login before tagging

* Rename travis-docker.yml to travis-docker.yml.bak

* Create github-docker.yml

* removed needs:init

* corrected the docker repo

* pushing to both docker and github

https://docs.github.com/en/actions/guides/publishing-docker-images

* renamed the github container name from my-image to sneakernet

* tags: latest

* adding extra LC_ALL to the end

* newer blast in Dockerfile

* blast library COPY statements

* reverting blast libs

* getting blast from mlst container

* manual installation of staramr

* manual installation of staramr2

* tag with hashsum values too

* trying to invoke the sha sum

* adding apt-get packages for staramr

* trying out docker push v2

* trying docker action v2

* fixed newline error

* removed ipython-notebook

* Update github-docker.yml

* Update Dockerfile

* numpy installation through pip now

* Removing multistage for pip-based images

* fixed apt-get command syntax

* changed tags to a value instead a list

* updated the tag

docker/build-push-action#160

* list of tags

* pushing to the github registry (?)

* one space before pipe

* Not sending to github packages; yes sending multiple tags to dockerhub

* removed list again

* Rename github-docker.yml to github-docker.yml.bak

* Create build-and-push-container.yml

* added this branch for github actions

* added libpython3.5-dev

```
#130 [linux/386 stage-11 34/47] RUN pip3 install poetry &&  git clone https:/...
#130 11.73   building '_openssl' extension
#130 11.73   creating build/temp.linux-x86_64-3.6/build
#130 11.73   creating build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6
#130 11.73   i686-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c build/temp.linux-x86_64-3.6/_openssl.c -o build/temp.linux-x86_64-3.6/build/temp.linux-x86_64-3.6/_openssl.o -Wconversion -Wno-error=sign-conversion
#130 11.73   build/temp.linux-x86_64-3.6/_openssl.c:50:14: fatal error: pyconfig.h: No such file or directory
#130 11.73    #    include <pyconfig.h>
#130 11.73                 ^~~~~~~~~~~~
#130 11.73   compilation terminated.
#130 11.73   error: command 'i686-linux-gnu-gcc' failed with exit status 1
#130 11.73   ----------------------------------------
#130 11.73   ERROR: Failed building wheel for cryptography
#130 11.73 Failed to build cryptography
#130 11.74 ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
#130 ERROR: executor failed running [/bin/sh -c pip3 install poetry &&  git clone https://github.com/hcdenbakker/SalmID.git --branch 0.1.23 --single-branch &&  cd SalmID &&  poetry build -vvv &&  pip3 install dist/salmid*.whl]: buildkit-runc did not terminate successfully
```

* fixed libpython-dev

* libpython3-dev

* newline.  Does it make things work

* separate some pip3 installations for staramr; removed numpy pip3

* removing staramr and salmid for right now

* removed all platforms except linux/amd64

* uncomment pip commands

* combined some pip commands for fewer layers

* Combined some chewbbaca steps into single layers

* RUN echo "LC_ALL=C" >> /etc/environment

* switched to UTF-8 per instructions

* apt-get install locales

Co-authored-by: Lee Katz - Aspen <gzu2@cdc.gov>
rfizzle added a commit to rfizzle/log-collector that referenced this issue Oct 21, 2020
@chase-moskal
Copy link

@chase-moskal chase-moskal commented Jun 29, 2021

hello, if anybody else gets stuck on this like i did, here's what i did to solve it

i had to fix my tags setting:

    - name: push image - server
      uses: docker/build-push-action@v2
      with:
        file: ./s/Dockerfile
        context: .
        push: true
        tags: ${{ env.REGISTRY }}/${{ github.repository }}/server:${{ github.sha }}

where

  • ${{ env.REGISTRY }} is equivalent with ghcr.io (the github packages registry)
  • ${{ github.repository }} is equivalent with chase-moskal/xiome (my github name and private repo's name)
  • server is the name i decided for my docker image, since my repo is pushing multiple different images
  • ${{ github.sha }} is simply the commit id, which i'm using to identify my staging images (i plan to use git v tags for real production releases)
  • thus it computes to something like ghcr.io/chase-moskal/xiome/server:69aa49cd2994f2063f908dd8868f1aa4da2385bddfbc0e069534a7fa5865cb08

this fixed the issue in my case, particularly adding the ghcr.io/ prefix

haraldkubota added a commit to haraldkubota/hackathon-starter that referenced this issue Jul 19, 2021
@pffont
Copy link

@pffont pffont commented Mar 23, 2022

Hello,

If someone is having the same issue, the solution for me was push to a new repository:

- name: push image - server
      uses: docker/build-push-action@v2
      with:
        push: true
        tags: myuser/new_repository/imagename:tag

@Drallas
Copy link

@Drallas Drallas commented Apr 19, 2022

I had this too, make sure myuser is set to you real docker username; that's what caused my Action to fail!

@philipzimmermann
Copy link

@philipzimmermann philipzimmermann commented May 9, 2022

For me the problem was that I had to login in Docker on the command line:
docker login --username=<username>

@lclarkg18
Copy link

@lclarkg18 lclarkg18 commented Jun 2, 2022

I had this too, make sure myuser is set to you real docker username; that's what caused my Action to fail!

Hiding in plain sight!! Thanks a million! It was just changing user for me though, but same line

tonvanbart pushed a commit to Axual/ksml that referenced this issue Jun 3, 2022
oppara added a commit to oppara/go-cve-dictionary that referenced this issue Jun 21, 2022
oppara added a commit to oppara/go-cve-dictionary that referenced this issue Jun 22, 2022
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

8 participants