How to configure a persistent volume for the Integrated Docker Registry in OpenShift 3
Environment
OpenShift Enterprise 3.0.X
Issue
- How do I configure Integrated Docker Registry for production use in OpenShift Enterprise?
Resolution
To add NFS a volume to your integrated Docker Registry for production follow these steps:
-
Create the exports in the NFS Server
-
Create your RegistryThis content is not included.2.5. Deploying a Docker Registry
# oadm registry --config=/etc/openshift/master/admin.kubeconfig --credentials=/etc/openshift/master/openshift-registry.kubeconfig --images='registry.access.redhat.com/openshift3/ose-${component}:${version}'
- Create a persistent volume object to be used for you registry
This content is not included.Persistent Storage Using NFS
# oc create -f pv-registry.json
# vim pv-registry.json
{
"apiVersion": "v1",
"kind": "PersistentVolume",
"metadata": {
"name": "registry-volume"
},
"spec": {
"capacity": {
"storage": "30Gi"
},
"accessModes": [ "ReadWriteMany" ],
"nfs": {
"path": "/share/registry",
"server": "172.17.0.2"
},
"persistentVolumeReclaimPolicy": "Recycle"
}
}
- Create a persistent volume claim in the default project to be bound to the Persistent Volume for use by your registry
This content is not included.Using Persistent Volumes
# oc create -f pvc-registry.json -n default
# vim pvc-registry.json
{
"apiVersion": "v1",
"kind": "PersistentVolumeClaim",
"metadata": {
"name": "registry-claim"
},
"spec": {
"volumeName": "registry-volume",
"accessModes": ["ReadWriteMany"],
"resources": {
"requests": {
"storage": "30Gi"
}
}
}
}
- Make sure the Claim have bound to your Persistent Volume
# oc get pvc -n default
NAME LABELS STATUS VOLUME AGE
registry-claim map[] Bound registry-volume 1m
- Add volume to registry
# oc set volume deploymentconfigs/docker-registry --add --overwrite --name=registry-storage --mount-path=/registry --type=persistentVolumeClaim --claim-name="registry-claim"
- Test by pulling an image to your registry
# docker login -u <username> -e <any_email_address> -p <token_value> <registry_service_host:port>
# docker pull registry.access.redhat.com/openshift3/ruby-20-rhel7
# docker tag registry.access.redhat.com/openshift3/ruby-20-rhel7 <registry-service-ip:port>/default/ruby-20-rhel7:latest
# docker push <registry-service-ip:port>/default/ruby-20-rhel7:latest
Product(s)
Category
Tags
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.