I've the OpenShift registry which will contain all my images I've created inside my OpenShift cluster. But I want to run an external registry on OpenShift.
At the moment it's just running with docker I performed this steps:
Create self-signed certificates (SSL)
$ mkdir -p certs && openssl req \
-newkey rsa:4096 -nodes -sha256 -keyout certs/domain.key \
-x509 -days 365 -out certs/domain.crt
Create user + password file
$ docker run --entrypoint htpasswd registry:2 -Bbn testuser testpassword > auth/htpasswd
Create container for storing data = "" container (not running)
$ docker create -v /var/lib/registry --name registry-dv registry:2
Start registry server
$ docker run -d -p 5000:5000 --restart=always --name ec2-52-29-xx-xx.xx-central-1.compute.amazonaws.com --volumes-from registry-dv \
-v `pwd`/auth:/auth \
-e "REGISTRY_AUTH=htpasswd" \
-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
-e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \
-v `pwd`/certs:/certs \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt \
-e REGISTRY_HTTP_TLS_KEY=/certs/domain.key \
Now is my question how I'm able to start this registry in OpenShift. Is it possible to use docker volume containers in OpenShift or do I have to use NFS or something ? And is it possible to use the -v and -e flag inside the oc new-app command? -e, --env=: Specify key value pairs of environment variables to set into each container should work so can I perform:
oc new-app registry:2 --name registry -e ...?
But the biggest problem seems to mee to mount the created certs and auth folder to the volume of my registry on OpenShift?
I read this: https://docs.openshift.com/enterprise/3.0/dev_guide/volumes.html
Is there maybe another example with the process of mounting folders inside volumes which will be used in OpenShift.