简体   繁体   中英

Unable to push to docker hub from github action despite of proper image tag

Here is my workflow file:

name: Integration

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: run docker-build with tag
      run: ./docker-build sudipbhandari/springboot-docker-app:$GITHUB_SHA
    - name: list docker images
      run: docker image ls
    - name: Docker Login
      uses: Azure/docker-login@v1
      with:
        login-server: 'docker.io'
        username: '{{secrets.DOCKER_HUB_USERNAME}}'
        password: '{{secrets.DOCKER_HUB_PASSWORD}}'
    - name : docker push
      run: docker push sudipbhandari/springboot-docker-app:$GITHUB_SHA 
    - name: clean up
      run: rm ~/.docker/config.json

Image:

***/springboot-docker-app                  8d0caac294f0e414b88cfe6cc433995ef7ca2f25

Docker push output:

Run docker push ***/springboot-docker-app:$GITHUB_SHA

[6](https://github.com/sudipbhandari126/springboot-docker-app/runs/477583287#step:6:6)The push refers to repository [docker.io/***/springboot-docker-app]

[7](https://github.com/sudipbhandari126/springboot-docker-app/runs/477583287#step:6:7)945b12e86d4e: Preparing

[8](https://github.com/sudipbhandari126/springboot-docker-app/runs/477583287#step:6:8)fff0debc90b1: Preparing

[9](https://github.com/sudipbhandari126/springboot-docker-app/runs/477583287#step:6:9)ceaf9e1ebef5: Preparing

[10](https://github.com/sudipbhandari126/springboot-docker-app/runs/477583287#step:6:10)9b9b7f3d56a0: Preparing

[11](https://github.com/sudipbhandari126/springboot-docker-app/runs/477583287#step:6:11)f1b5933fe4b5: Preparing

[12](https://github.com/sudipbhandari126/springboot-docker-app/runs/477583287#step:6:12)denied: requested access to the resource is denied
  • Image is properly tagged (username/imagename:tag)
  • Docker login is successful to registry (docker.io)

Still I am gettting permission denied.

I locally built and tried to push the image and it works just fine.

docker push sudipbhandari/springboot-docker-app:a
The push refers to repository [docker.io/sudipbhandari/springboot-docker-app]
f2f6c53c3c45: Layer already exists 
9ff7271739b8: Layer already exists 
ceaf9e1ebef5: Layer already exists 
9b9b7f3d56a0: Layer already exists 
f1b5933fe4b5: Layer already exists 
a: digest: sha256:ecf90929be9690c052bcc457edd5bb12cbe231029b63536d94e0e86cd845b983 size: 1366

First, in GitHub go to Setting>Secrets and add two repository secrets for DOCKER_USERNAME and DOCKER_PASSWORD . Then try this:

 - run: 
      echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
    env:
      $DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
      $DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM