Bug 1311452

Summary: The docker registry does not work well with special volume
Product: OKD Reporter: zhou ying <yinzhou>
Component: Image RegistryAssignee: Paul Weil <pweil>
Status: CLOSED CURRENTRELEASE QA Contact: Wei Sun <wsun>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 3.xCC: aos-bugs
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-12 17:10:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description zhou ying 2016-02-24 09:52:52 UTC
Description of problem:
The docker registry does not work well with special volume

Version-Release number of selected component (if applicable):
openshift v1.1.3-194-gbe12c82
kubernetes v1.2.0-alpha.7-703-gbc4550d
etcd 2.2.5

How reproducible:
Always

Steps to Reproduce:
1. Start OpenShift;
2. Create integrated docker registry with special volume:
`oadm registry --create --credentials=openshift.local.config/master/openshift-registry.kubeconfig --config=openshift.local.config/master/admin.kubeconfig  --volume='/registrytest'`
3. Login OpenShift and do STI build
Actual results:


Expected results:
3. The build will failed with error:Failed to push image. Response from registry is: Received unexpected HTTP status: 500 Internal Server Error

Check the registry's log, has error too:
time="2016-02-24T03:09:05.564311255Z" level=error msg="response completed with error" err.code=UNKNOWN err.detail="filesystem: mkdir /registry/docker: permission denied" err.message="unknown error" go.version=go1.4.2 http.request.host="172.30.56.122:5000" http.request.id=40b90277-65f5-4b7c-9bb3-3ae6482988f6 http.request.method=POST http.request.remoteaddr="172.18.8.43:49950" http.request.uri="/v2/zhouyt/origin-ruby-sample/blobs/uploads/" http.request.useragent="docker/1.8.2-el7 go/go1.4.2 kernel/3.10.0-229.7.2.el7.x86_64 os/linux arch/amd64" http.response.contenttype="application/json; charset=utf-8" http.response.duration=164.2573ms http.response.status=500 http.response.written=156 instance.id=6ab02965-bc4a-4dba-8d9f-298398055696 vars.name="zhouyt/origin-ruby-sample"

Additional info:
The registry with special volume works well .

Comment 1 Paul Weil 2016-02-24 15:23:11 UTC
Using --volume means that you're trying to change the default directory for storage.  This should be accompanied by a change in the config.yaml for the image or a change in the deployment config to add the env var 

- name: REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY
          value: /registrytest

otherwise, it will continue to try to use the default /registry as the basedir and it will not be mounted as an emptydir volume which includes the correct write permissions.  That is what is giving the "permission denied" error.

Comment 2 zhou ying 2016-02-25 08:45:09 UTC
Hi Paul:
  Thanks ! 
  I add the env var by:
`oc env dc/docker-registry  REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/registrytest` works well . Will update the cases.