How do I use a dockerhub pull secret in a BuildConfig docker strategy

Posted on

I'm on OpenShift 4.10. I'm building a new-app from my Bitbucket code repo and my code has a Dockerfile in it that I need to run to build the application.

e.g. oc new-app '' --strategy=docker --name="myapp" --as-deployment-config

The Dockerfile in the root of the project has a FROM that is a private Dockerhub repo. I'd like to be able to pass my dockerhub pull secret to the builder to use it to access the private repo but I cannot seem to get this working.

I've used the secret to successfully pull from the private repo and this worked by linking the secret to default. I tried to do something similar with the builder:

oc secrets link builder dockerhub-pull-secret --for=pull

This does not work. After I run oc new-app ..., I check the logs and I see an error that it cannot pull from my private Dockerhub repo.

Any ideas would be helpful.