On Mon, Feb 22, 2016 at 4:22 AM, Den Cowboy <[email protected]> wrote:

> 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.
>

What's your motivation for running a separate registry?


> 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 = volume 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 \
>
> registry:2
>
> 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 ?
>

We wouldn't recommend Docker volumes as they are specific to whatever host
your container runs on, and are not managed by OpenShift. Instead, if you
want data persistence, you should use a persistent volume. See
https://docs.openshift.com/enterprise/3.0/dev_guide/persistent_volumes.html.


> 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 ...?
>

Yes, you can specify -e for env vars. You'll need to do volumes separately.
See below.


> 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.
>

We recommend putting sensitive information such as keys and certificates in
secrets, and then mounting 1 or more secrets volumes into your container.
You can use the 'oc volume' command to do this. See:

https://docs.openshift.com/enterprise/3.0/dev_guide/secrets.html
https://docs.openshift.com/enterprise/3.0/dev_guide/volumes.html




>
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.openshift.redhat.com/openshiftmm/listinfo/users
>
>
_______________________________________________
users mailing list
[email protected]
http://lists.openshift.redhat.com/openshiftmm/listinfo/users

Reply via email to