Pull images with docker hub credentials


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:

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

- name: release-and-push
  - get: project
    trigger: true
  - get: git-repo  
  - put: ecr-docker-reg
      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: