2

I've been trying (rather futilely) this afternoon to try and stop docker-registry from writing to stdout but rather a log but I think the underlying Python is creating processes which seem to bypass all efforts of channelling to a log.

I've tried the usual > and 2>&1 and with piping to various commands but it all seems to escape my grasp.

Is there anyway I can get all output of this command to go straight to a log rather than stdout?

[edit]

This is the script I'm using to start it up, it's part of a shell script I plan to use as a service

start() {
  # Sugar
  echo -e "Starting registry"

  # Run the registry
  export LOGLEVEL=NOTSET
  export AWS_BUCKET=$TargetBucket
  export AWS_KEY=$AWSAccessKey
  export AWS_SECRET=$AWSSecretKey
  docker-registry & 2>&1 | tee $LogFile

  # Create a lock file
  touch $LockFile
}
  • What OS/distribution? How do you start the process? What settings do you have in your docker-registry.yaml WRT logvel and *_logfile? – dawud Jul 12 '14 at 5:49
  • I don't appear to have a docker-registry.yaml or yml file anywhere, I'm running CentOS 6.5 and docker 1.0. For what it's worth I installed docker-registry through pip rather than from the github repo. – Dave Mackintosh Jul 14 '14 at 8:35
  • According to the github page of the project, you should have a config_sample.yml file. Otherwise, you would need to write one and place it in the config dir, I don't know where does the pip install places it. – dawud Jul 14 '14 at 8:48
  • I'm doing everything with environmentals, seems easier that way although no differing type of logging level appears to make a difference. – Dave Mackintosh Jul 14 '14 at 9:25
  • I've added the part of the shell script I'm using to start it to the original post to see if it's just something I've missed through frustration. – Dave Mackintosh Jul 14 '14 at 9:26
2

In case other still looking for the answer, I just realize with myself recently.

When you install the docker-registry rpm and start the service, the log file is store within systemd journal file itself.

Here is the command to retrieve the log: sudo journalctl -fu docker-registry.service

The same way to get docker log also.

You can also edit the /usr/lib/systemd/system/docker-registry.service and replace the - after --access-logfile with the file you want. Service restart is required.

0

Make your life easier by using the precompiled packages available in EPEL: docker-io-1.0.0-6.el6.x86_64.rpm and docker-registry-0.7.1-2.el6.noarch.rpm as of this writing.

You will have and already working service script (no need to roll your own), you will receive updates (easier than recompiling or reinstalling from pip) and OS integration.

Your problem with logs disappears, as logs are configured in the /etc/docker-registry.yaml file (referenced from /etc/sysconfig/docker-registry using DOCKER_REGISTRY_CONFIG=/etc/docker-registry.yml)

You can define where you logs point to using the loglevel: directive in the common section, or per-provider using *_logfile:.

If you prefer to stick with a manual installation, note that usually the docker-registry is serverd by gunicorn, using the following command (this is taken from a Fedora 20 installation, it shouldn't be too different):

/usr/bin/gunicorn --access-logfile - --debug --max-requests 100 --graceful-timeout 3600 \
  -t 3600 -k gevent -b ${REGISTRY_ADDRESS}:${REGISTRY_PORT} -w $GUNICORN_WORKERS \
  docker_registry.wsgi:application

(The --access-logfile being the stdin is a systemd thing)

  • That docker registry rpm doesn't actually appear to do anything? Says service has started but nmap, netstat, pidof and ps aux all show nothing.. – Dave Mackintosh Jul 14 '14 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.