Bug 1038874 - Docker-registry does not currently support moving the config file
Summary: Docker-registry does not currently support moving the config file
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: docker-registry
Version: el6
Hardware: Unspecified
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Marek Goldmann
QA Contact: Fedora Extras Quality Assurance
URL: https://github.com/dotcloud/docker-re...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-12-06 01:57 UTC by Chris Murphy
Modified: 2013-12-27 22:16 UTC (History)
2 users (show)

Fixed In Version: docker-registry-0.6.0-4.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-12-19 07:16:08 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
etc_sysconfig_docker-registry (347 bytes, text/plain)
2013-12-06 14:13 UTC, Chris Murphy
no flags Details
etc_docker-registry.yml (1.31 KB, text/plain)
2013-12-06 14:15 UTC, Chris Murphy
no flags Details

Description Chris Murphy 2013-12-06 01:57:13 UTC
Description of problem:
Docker-registry does not currently support moving the config file. From the README.md for the project https://github.com/dotcloud/docker-registry:

"The location of the yaml file should be relative to the source directory. Absolute paths are not yet supported."

So setting the variable $DOCKER_REGISTRY_CONFIG has no effect.

Possibly creating a symlink from /etc/docker-registry.yml to /usr/lib/python2.6/site-packages/docker-registry/config.yml in the RPM would be the easiest solution until upstream fixes this issue.

Version-Release number of selected component (if applicable):
docker-registry-0.6.0-3.el6.noarch

How reproducible:
Always

Steps to Reproduce:
1.Install docker-registry on RHEL
2.Try to start the program
3.

Actual results:
2013-12-05 15:15:42 [16957] [ERROR] Exception in worker process:
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
    worker.init_process()
  File "/usr/lib/python2.6/site-packages/gunicorn/workers/ggevent.py", line 165, in init_process
    super(GeventWorker, self).init_process()
  File "/usr/lib/python2.6/site-packages/gunicorn/workers/base.py", line 106, in init_process
    self.wsgi = self.app.wsgi()
  File "/usr/lib/python2.6/site-packages/gunicorn/app/base.py", line 114, in wsgi
    self.callable = self.load()
  File "/usr/lib/python2.6/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
    return self.load_wsgiapp()
  File "/usr/lib/python2.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/lib/python2.6/site-packages/gunicorn/util.py", line 354, in import_app
    __import__(module)
  File "/usr/lib/python2.6/site-packages/docker-registry/wsgi.py", line 11, in <module>
    import registry
  File "/usr/lib/python2.6/site-packages/docker-registry/registry/__init__.py", line 4, in <module>
    from .app import app
  File "/usr/lib/python2.6/site-packages/docker-registry/registry/app.py", line 7, in <module>
    import toolkit
  File "/usr/lib/python2.6/site-packages/docker-registry/registry/toolkit.py", line 14, in <module>
    import storage
  File "/usr/lib/python2.6/site-packages/docker-registry/lib/storage/__init__.py", line 116, in <module>
    from glance import GlanceStorage
  File "/usr/lib/python2.6/site-packages/docker-registry/lib/storage/glance.py", line 11, in <module>
...skipping...
  File "/usr/lib/python2.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/lib/python2.6/site-packages/gunicorn/util.py", line 354, in import_app
    __import__(module)
  File "/usr/lib/python2.6/site-packages/docker-registry/wsgi.py", line 11, in <module>
    import registry
  File "/usr/lib/python2.6/site-packages/docker-registry/registry/__init__.py", line 4, in <module>
    from .app import app
  File "/usr/lib/python2.6/site-packages/docker-registry/registry/app.py", line 7, in <module>
    import toolkit
  File "/usr/lib/python2.6/site-packages/docker-registry/registry/toolkit.py", line 14, in <module>
    import storage
  File "/usr/lib/python2.6/site-packages/docker-registry/lib/storage/__init__.py", line 116, in <module>
    from glance import GlanceStorage
  File "/usr/lib/python2.6/site-packages/docker-registry/lib/storage/glance.py", line 11, in <module>
    from .local import LocalStorage
  File "/usr/lib/python2.6/site-packages/docker-registry/lib/storage/local.py", line 5, in <module>
    import cache
  File "/usr/lib/python2.6/site-packages/docker-registry/lib/cache.py", line 86, in <module>
    init()
  File "/usr/lib/python2.6/site-packages/docker-registry/lib/cache.py", line 23, in init
    cfg = config.load()
  File "/usr/lib/python2.6/site-packages/docker-registry/lib/config.py", line 53, in load
    with open(config_path) as f:
IOError: [Errno 2] No such file or directory: '/usr/lib/python2.6/site-packages/docker-registry/lib/../config.yml'

Expected results:
Program starts

Additional info:
# At 2013-12-05 17:23:50 in /usr/lib/python2.6/site-packages/docker-registry
# root@docker-poc # ln -s /etc/docker-registry.yml /usr/lib/python2.6/site-packages/docker-registry/config.yml

# At 2013-12-05 17:23:51 in /usr/lib/python2.6/site-packages/docker-registry
# root@docker-poc # service docker-registry restart && tailf /var/log/docker-registry
Starting docker-registry:	                           [  OK  ]
2013-12-05 17:23:52 [18297] [INFO] Starting gunicorn 18.0
2013-12-05 17:23:52 [18297] [INFO] Listening at: http://0.0.0.0:5000 (18297)
2013-12-05 17:23:52 [18297] [INFO] Using worker: gevent
2013-12-05 17:23:52 [18303] [INFO] Booting worker with pid: 18303
2013-12-05 17:23:52 [18304] [INFO] Booting worker with pid: 18304
2013-12-05 17:23:53 [18305] [INFO] Booting worker with pid: 18305
2013-12-05 17:23:53 [18306] [INFO] Booting worker with pid: 18306
2013-12-05 17:23:53 [18307] [INFO] Booting worker with pid: 18307
2013-12-05 17:23:53 [18308] [INFO] Booting worker with pid: 18308
2013-12-05 17:23:53 [18309] [INFO] Booting worker with pid: 18309
2013-12-05 17:23:53 [18310] [INFO] Booting worker with pid: 18310

Comment 1 Marek Goldmann 2013-12-06 08:13:35 UTC
Hi Chris,

Pelase note that you can specify the configuration file location in the /etc/sysconfig/docker-registry file. Here is the current (default) content of it:

===============

# The Docker registry configuration file
DOCKER_REGISTRY_CONFIG=/etc/docker-registry.yml

# The configuration to use from DOCKER_REGISTRY_CONFIG file
SETTINGS_FLAVOR=local

# Address to bind the registry to
REGISTRY_ADDRESS=0.0.0.0

# Port to bind the registry to
REGISTRY_PORT=5000

# Number of workers to handle the connections
GUNICORN_WORKERS=8


===============

If you specify the new patch there and restart the service running "service docker restart" should work.

Comment 2 Marek Goldmann 2013-12-06 08:14:15 UTC
I mean "path", of course :)

Comment 3 Chris Murphy 2013-12-06 14:13:36 UTC
Created attachment 833621 [details]
etc_sysconfig_docker-registry

My /etc/sysconfig/docker-registry file that was in place when the program stack traced and crashed as shown in previous comment.

Comment 4 Chris Murphy 2013-12-06 14:15:26 UTC
Created attachment 833632 [details]
etc_docker-registry.yml

My /etc/docker-registry.yml file that was in place when the program crashed.

Comment 5 Marek Goldmann 2013-12-06 14:30:56 UTC
Sorry, I misunderstod you. I'll have a fix for you soon.

Comment 6 Chris Murphy 2013-12-06 14:34:02 UTC
Hi Marek,

I know that you're trying to export the location of the configuration file path as well as the name of the file in the variable $DOCKER_REGISTRY_CONFIG.  However,

1) $DOCKER_REGISTRY_CONFIG only refers to the name of the config file and has no relationship with the path to the file
2) The variable get overwritten somewhere along the way regardless so it really doesn't matter what you put in the variable

As I said before in comment #1, the application doesn't allow you to change the path from /usr/lib/python2.6/site-packages/docker-registry/ which is clearly documented on their README.md for the project https://github.com/dotcloud/docker-registry:

"The location of the yaml file should be relative to the source directory. Absolute paths are not yet supported.". 

As soon as the application starts up, that variable is thrown out and replaced with /usr/lib/python2.6/site-packages/docker-registry/lib/../config.py . You can see how this happens in the function "def load()" on line 52 in the file /usr/lib/python2.6/site-packages/docker-registry/lib/config.py.

I've tested this twice and unless you symlink or copy the file to the location where the application has it hardcoded, the application will not start.

Thanks,
Chris

Comment 7 Chris Murphy 2013-12-06 14:34:38 UTC
Hey Marek,

Sorry, I didn't see your comment.

Thanks for looking into this.

Chris

Comment 8 Marek Goldmann 2013-12-06 15:19:26 UTC
Please test this scratch build, if it works for you - I'll submit is as an update:

http://koji.fedoraproject.org/koji/taskinfo?taskID=6264560

I've decided to patch docker-registry - I added support for absolute paths. I'll send a PR upstream once you confirm that it works as expected.

Thanks!

Comment 9 Chris Murphy 2013-12-06 16:39:43 UTC
Marek,

Spun up a new RHEL 6.5 image in AWS and tested the build and the service came up exactly as expected on first attempt. I would consider this bug fixed.

Nice decision to fix for upstream instead of my hackish suggestion. This will benefit a lot of people.

Thanks,
Chris

Comment 10 Marek Goldmann 2013-12-09 07:40:26 UTC
Alright, thanks for testing!

Once I'll have a PR ready, I'll add the link.

Comment 11 Fedora Update System 2013-12-09 08:54:49 UTC
docker-registry-0.6.0-4.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/docker-registry-0.6.0-4.fc19

Comment 12 Fedora Update System 2013-12-09 08:55:02 UTC
docker-registry-0.6.0-4.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/docker-registry-0.6.0-4.fc20

Comment 13 Fedora Update System 2013-12-09 08:55:15 UTC
docker-registry-0.6.0-4.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/docker-registry-0.6.0-4.el6

Comment 14 Marek Goldmann 2013-12-09 08:57:05 UTC
Pull request sent! https://github.com/dotcloud/docker-registry/pull/148

Comment 15 Fedora Update System 2013-12-09 20:24:45 UTC
Package docker-registry-0.6.0-4.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing docker-registry-0.6.0-4.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-23024/docker-registry-0.6.0-4.fc20
then log in and leave karma (feedback).

Comment 16 Fedora Update System 2013-12-19 07:16:08 UTC
docker-registry-0.6.0-4.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 17 Fedora Update System 2013-12-19 07:19:35 UTC
docker-registry-0.6.0-4.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 18 Fedora Update System 2013-12-27 22:16:05 UTC
docker-registry-0.6.0-4.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.