Home > Enterprise >  How to pull a private image from Docker Hub using github actions
How to pull a private image from Docker Hub using github actions

Time:12-07

I have a workflow where I need to pull a image from a private repository from Docker Hub. My job is the following:

  run-flake8:
    name: Run Flake 8
    runs-on: "ubuntu-20.04"
    needs: [django-dev-image]
    container:
      image: docker://index.docker.io/v1/<repository_name>/<image_name>:latest
      credentials:
        username: ${{ secrets.DOCKERHUB_USERNAME }}
        password: ${{ secrets.DOCKERHUB_PASSWORD }}
    steps:
    - name: Print something
      run: echo "Testing flake8 job"

Job fails with repository does not exist or may require 'docker login': denied: requested access to the resource is denied. I feel like my docker hub registry url is wrong, but I can't figure out what is the correct one, any help is more than appreciated.

Thank you all

CodePudding user response:

When referring to DockerHub, you should not need to specify the docker registry.

run-flake8:
name: Run Flake 8
runs-on: "ubuntu-20.04"
needs: [django-dev-image]
container:
  image: <repository_name>/<image_name>:latest
  credentials:
    username: ${{ secrets.DOCKERHUB_USERNAME }}
    password: ${{ secrets.DOCKERHUB_PASSWORD }}
steps:
- name: Print something
  run: echo "Testing flake8 job"
  • Related