I’m trying to build an OCI image using the s2i mechanism of OpenShift.
The Dockerfile is multi-stage, both base images are hosted inside two different, only privately accessible docker repositories.
My BuildConfig looks like this:
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: ${NAME}
spec:
failedBuildsHistoryLimit: 5
nodeSelector: { }
output:
pushSecret:
name: ${PUSH_SECRET}
to:
kind: DockerImage
name: >-
${IMAGE_NAME}:${IMAGE_VERSION}
postCommit: { }
resources: { }
runPolicy: Serial
source:
binary: { }
type: Binary
strategy:
dockerStrategy:
pullSecret:
name: ${PULL_SECRET}
type: Docker
successfulBuildsHistoryLimit: 5
triggers: [ ]
I know I can supply the ImagePullSecret to use with the .spec.strategy.dockerStrategy.pullSecret.name
field. But how can I use multiple pull secrets, i.e. enable the build to pull from two separate private docker registries?
Creating the ImagePullSecrets in OpenShift and then assigning them to the builder
ServiceAccount did not work, as s2i seems to ignore this configuration and only use the secrets listed in the BuildConfig.
2
Answers
You can specify multiple auths inside a single pull secret.
The field :
spec.strategy.dockerStrategy.pullSecret
must contains only onepullSecret
.Make sure you have define all registry server name/auth inside your pull secret, for example: