{"id":153,"date":"2015-10-27T13:43:52","date_gmt":"2015-10-27T10:43:52","guid":{"rendered":"http:\/\/small-service.com\/?p=153"},"modified":"2018-07-27T12:25:47","modified_gmt":"2018-07-27T09:25:47","slug":"install-docker-registry-in-openshift","status":"publish","type":"post","link":"https:\/\/small-service.com\/?p=153","title":{"rendered":"Install docker-registry in openshift"},"content":{"rendered":"<p>there are a lot of docs regarding installation. I will post only commands here with very small comments.<br \/>\n<!--more--><\/p>\n<ol>\n<li>\u00a0if not exist:<br \/>\n        <code>echo '{\"kind\":\"ServiceAccount\",\"apiVersion\":\"v1\",\"metadata\":{\"name\":\"registry\"}}' | oc create -n default -f -<\/code><\/li>\n<li>Add a line under users with the user name system:serviceaccount:default:registry in:<br \/>\n        <code>oc edit scc privileged<\/code><\/li>\n<li>Create the registry and specify that it use the new registry service account:<br \/>\n        <code>oadm registry --service-account=registry --config=\/etc\/origin\/master\/admin.kubeconfig --credentials=\/etc\/origin\/master\/openshift-registry.kubeconfig  --latest-images<\/code><\/li>\n<li>in case you will use gluster storage (as me) to store registry. Create gluster endpoint file:\n<pre>\r\napiVersion: v1\r\nkind: Endpoints\r\nmetadata:\r\n  name: gluster\r\nsubsets:\r\n- addresses:\r\n  - ip: <gluster server>\r\n  ports:\r\n  - port: 1<\/pre>\n<p><code>oc create -f gluster_endpoint.yml <\/code><\/li>\n<li>Attach GlusterFS volume to the registry:<br \/>\n        <code> oc volume dc\/docker-registry --add --overwrite --name=registry-storage --mount-path=\/registry --source='{\"glusterfs\": { \"endpoints\": \"gluster\", \"path\": \"\/gluster\/volume\/name\"}}'<\/code><\/li>\n<li>Update dc to run privileged container by updating tag <b>privileged: true<\/b> in deploymentconfig docker-registry:<br \/>\n<code>oc edit dc docker-registry<\/code><\/li>\n<li>Making it visible from outside by adding tag <b>hostNetwork: true<\/b> in deploymentconfig docker-registry (after dnsPolicy: ClusterFirst):<br \/>\n<code>oc edit dc docker-registry<\/code><\/li>\n<li>once new pod created checking repository content:<br \/>\n<code>oc login<br \/>\noc whoami -t<br \/>\ndocker login -u username -e any_email_address -p token_value docker_registry_host:5000<br \/>\ndocker pull docker.io\/ubuntu<br \/>\ndocker tag docker.io\/ubuntu docker_registry_host:5000\/current_namespace\/ubuntu<br \/>\ndocker push docker_registry_host:5000\/current_namespace\/ubuntu<\/code><\/li>\n<\/ol>\n<p>PS. Used links:<br \/>\n<a href=\"https:\/\/docs.openshift.com\/enterprise\/3.0\/rest_api\/kubernetes_v1.html#v1-glusterfsvolumesource\" target=\"_blank\">Openshift &#8211; v1.GlusterfsVolumeSource<\/a><br \/>\n<a href=\"https:\/\/docs.openshift.com\/enterprise\/3.0\/rest_api\/kubernetes_v1.html#v1-volume\" target=\"_blank\">Openshift &#8211; volume source type<\/a><br \/>\n<a href=\"https:\/\/docs.openshift.com\/enterprise\/3.0\/dev_guide\/volumes.html\" target=\"_blank\">Openshift &#8211; Managing Volumes<\/a><br \/>\n<a href=\"https:\/\/docs.openshift.org\/latest\/install_config\/install\/docker_registry.html\" target=\"_blank\">Openshift &#8211; Deploying a Docker Registry<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>there are a lot of docs regarding installation. I will post only commands here with very small comments.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[63],"tags":[67,66,64,65],"_links":{"self":[{"href":"https:\/\/small-service.com\/index.php?rest_route=\/wp\/v2\/posts\/153"}],"collection":[{"href":"https:\/\/small-service.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/small-service.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/small-service.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/small-service.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=153"}],"version-history":[{"count":11,"href":"https:\/\/small-service.com\/index.php?rest_route=\/wp\/v2\/posts\/153\/revisions"}],"predecessor-version":[{"id":310,"href":"https:\/\/small-service.com\/index.php?rest_route=\/wp\/v2\/posts\/153\/revisions\/310"}],"wp:attachment":[{"href":"https:\/\/small-service.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/small-service.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/small-service.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}