Install docker-registry in OpenShift
oadm, oc volume). Current OpenShift versions work differently.There are plenty of docs about the installation; here are just the commands with short comments.
Create the
registryservice account if it doesn’t exist:echo '{"kind":"ServiceAccount","apiVersion":"v1","metadata":{"name":"registry"}}' | oc create -n default -f -Add
system:serviceaccount:default:registryunderusersin the privileged SCC:oc edit scc privilegedCreate the registry using the new service account:
oadm registry --service-account=registry --config=/etc/origin/master/admin.kubeconfig --credentials=/etc/origin/master/openshift-registry.kubeconfig --latest-imagesIf you store the registry on GlusterFS (as I do), create a Gluster endpoint file
gluster_endpoint.yml:apiVersion: v1 kind: Endpoints metadata: name: gluster subsets: - addresses: - ip: <gluster server> ports: - port: 1and apply it:
oc create -f gluster_endpoint.ymlAttach the GlusterFS volume to the registry:
oc volume dc/docker-registry --add --overwrite --name=registry-storage --mount-path=/registry --source='{"glusterfs": { "endpoints": "gluster", "path": "/gluster/volume/name"}}'Run the registry as a privileged container – set
privileged: truein thedocker-registrydeployment config:oc edit dc docker-registryMake it reachable from outside – add
hostNetwork: trueto the same deployment config (afterdnsPolicy: ClusterFirst):oc edit dc docker-registryOnce the new pod is running, test the registry:
oc login oc whoami -t docker login -u username -e any_email_address -p token_value docker_registry_host:5000 docker pull docker.io/ubuntu docker tag docker.io/ubuntu docker_registry_host:5000/current_namespace/ubuntu docker push docker_registry_host:5000/current_namespace/ubuntu