build-push-action icon indicating copy to clipboard operation
build-push-action copied to clipboard

buildx call failed with: error: denied: requested access to the resource is denied

Open Recedivies opened this issue 4 years ago • 17 comments

Hi, I am trying to build and push a container to dockerhub as following

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    - name: Login to DockerHub
      uses: docker/login-action@v1
      with:
        username: ${{ secrets.DOCKERHUB_USERNAME }}
        password: ${{ secrets.DOCKERHUB_TOKEN }}

    - name: Build and push
      uses: docker/build-push-action@v2
      with:
        push: true
        tags: devopsdockeruh/coursepage:latest

Unfortunately I am getting error "buildx call failed with: error: denied: requested access to the resource is denied". Am I doing wrong?

Recedivies avatar Jan 05 '22 03:01 Recedivies

@Recedivies Would need link to your repo and/or Dockerfile and complete logs of the workflow build step.

crazy-max avatar Jan 05 '22 18:01 crazy-max

@crazy-max here's the link my repo https://github.com/Recedivies/deploy-docker

Recedivies avatar Jan 06 '22 04:01 Recedivies

@Recedivies Looks like secrets.DOCKERHUB_USERNAME is not allowed to push to devopsdockeruh/coursepage. Check secrets.DOCKERHUB_TOKEN token is allowed to write to this repo in https://hub.docker.com/settings/security and also maybe a typo in devopsdockeruh/coursepage.

crazy-max avatar Jan 06 '22 11:01 crazy-max

@crazy-max I have set the token's scope to "Read & Write". So, how do i achieve that then?

Recedivies avatar Jan 07 '22 08:01 Recedivies

is there a solution to this? i have also encountered this problem.

ArnonAsquira avatar Jan 12 '22 10:01 ArnonAsquira

@Recedivies @ArnonAsquira Does it work locally on your machine when you log in with those credentials and push to Docker Hub?

crazy-max avatar Jan 12 '22 10:01 crazy-max

@crazy-max It worked after I changed the name of the image using docker tag. This change also made the Github action work. This very might be relevant to the publisher of the post.

ArnonAsquira avatar Jan 12 '22 11:01 ArnonAsquira

@crazy-max @ArnonAsquira me either. It worked to me after i changed the name of image.

Recedivies avatar Jan 12 '22 12:01 Recedivies

In my case, the name of image was correct, but I had a similar problem. Turned out I've already had one private repository on Docker Hub, so I couldn't create another one. So deleting all private repositories solved my problem.

platinum139 avatar Jul 08 '22 17:07 platinum139

This happened to me also when I started tagging the container images...

jcalopes avatar Jan 13 '23 12:01 jcalopes

Someone knows how to solve that?

jcalopes avatar Jan 13 '23 12:01 jcalopes

Are you guys prefixing your userspace/image:taghash with the correct hostname?

Mine was fixed by prefixing ghcr.io/ to the image name.

maietta avatar Feb 12 '23 23:02 maietta

Looks like if you set tags then they need to have ghcr.io/ or ${{ env.REGISTRY }}/ otherwise it defaults to docker.io

samtygier-stfc avatar Apr 03 '23 14:04 samtygier-stfc

It's because you are not supposed to push the docker image with the following tag tags: devopsdockeruh/coursepage:latest devopsdockeruh should be replaced by your own username.

daniel-hyun-chae avatar Apr 17 '23 12:04 daniel-hyun-chae

I get the same error, I wanna push to a private rep of a organization that my account is in. Anyone had this before?

denizdoingstuff avatar Nov 19 '23 00:11 denizdoingstuff

Label your tags this way for dockerhub

tags: ${{ secrets.DOCKER_USERNAME }}/my-own-tag:1.0

zikozee avatar Feb 09 '24 23:02 zikozee

To add on to the solution by @zikozee It worked for me with :

  • tags: ${{ secrets.DOCKERHUB_USERNAME }}/test:1.0

KeshavSingh29 avatar Apr 04 '24 07:04 KeshavSingh29