Login Docker Hub
Login to Docker Hub
Why do I need this?
Docker Hub has pull rate limits. If you’re not logged in, you will have a shared quota for those pulls which you will not control.
To avoid this you should be using either a team account or organization account to login as part of the p2p-build
step in the Makefile.
By having your own account, you’ll ensure only that you have your own quota that is not shared by anyone so you’ll have more predictable limitations
How to login
After you create an account, you’ll need to have to create a Personal Access Token. You can follow that link or go to Account Settings->Personal access token
.

You can then generate a new one with Public Repo Read-only
Access permissions.
Configuring p2p
In order to use the the token, we’ll create a new secret in GitHub and call it DOCKERHUB_PAT
. You can also store the username there with DOCKERHUB_USER
.
Then we’ll modify our fast-feedback.yaml workflow to include that secret as an environment variable. Don’t worry, this will still be encoded and treated as a secret
fastfeedback:
needs: [version]
uses: coreeng/p2p/.github/workflows/p2p-workflow-fastfeedback.yaml@v1
secrets:
env_vars: |
DOCKERHUB_USER=${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_PAT=${{ secrets.DOCKERHUB_PAT }}
Now we need to jump over to the Makefile
and locate our p2p-build
task.
We’ll create a new task docker-login
and add it as a dependency to the p2p-build
.PHONY: p2p-build
p2p-build: docker-login build-docker ## Builds the service image and pushes it to the registry
.PHONY: docker-login
docker-login: # Login to docker
echo $(DOCKERHUB_PAT) | docker login -u $(DOCKERHUB_USER) --password-stdin