build-push-action: buildx call failed with: error: denied: requested access to the resource is denied
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?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 17 (3 by maintainers)
Are you guys prefixing your userspace/image:taghash with the correct hostname?
Mine was fixed by prefixing ghcr.io/ to the image name.
Label your tags this way for dockerhub
tags: ${{ secrets.DOCKER_USERNAME }}/my-own-tag:1.0
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.
@crazy-max I have set the token’s scope to “Read & Write”. So, how do i achieve that then?
To add on to the solution by @zikozee It worked for me with :
tags: ${{ secrets.DOCKERHUB_USERNAME }}/test:1.0Looks like if you set
tagsthen they need to haveghcr.io/or${{ env.REGISTRY }}/otherwise it defaults todocker.io