Pull images with docker hub credentials

Hi,

Due to the docker hub limit we need to specify our docker hub username and password for our docker hub users. Since we mainly use AWS ECR for our images, it gets a bit tricky to pull images from docker hub with docker hub credentials and then push to our ECR repository.

Here is an example pipeline to describe our standard pipelines:

resources:
- name: project
  type: github-release
  source:
    owner: ((github_username))
    repository: ((github_repo))
    access_token: ((github_access_token))
    
- name: ecr-docker-image
  type: docker-image
  source:
    aws_access_key_id: ((aws_key))
    aws_secret_access_key: ((aws_secret))
    repository: ((aws_repo))
    
- name: git-repo
  type: git
  source:
    uri: ((github_repo)
    branch: ((git_branch))
    username: ((github_username))
    password: ((github_access_token))

jobs:
- name: release-and-push
  plan:
  - get: project
    trigger: true
  - get: git-repo  
  - put: ecr-docker-reg
    params:
      build: ./git-repo
      tag_file: .git/HEAD

This pipeline will pull a docker image specified in a Dockerfile in our github repository, and push it to ECR. How can we specify that we want to use docker hub username and password for our pull action?

I solved this by splitting the build and pull job by following this blog: