macOS setup guide

Use-case

This is useful if you intend to run a registry server natively on macOS.

Alternatives

You can start a VM on macOS, and deploy your registry normally as a container using Docker inside that VM.

Solution

Using the method described here, you install and compile your own from the git repository and run it as an macOS agent.

Gotchas

Production services operation on macOS is out of scope of this document. Be sure you understand well these aspects before considering going to production with this.

Setup golang on your machine

If you know, safely skip to the next section.

If you don’t, the TLDR is:

  1. $ bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
  2. $ source ~/.gvm/scripts/gvm
  3. $ gvm install go1.4.2
  4. $ gvm use go1.4.2

If you want to understand, you should read How to Write Go Code.

Checkout the source tree

  1. $ mkdir -p $GOPATH/src/github.com/distribution
  2. $ git clone https://github.com/distribution/distribution.git $GOPATH/src/github.com/distribution/distribution
  3. $ cd $GOPATH/src/github.com/distribution/distribution

Build the binary

  1. $ GOPATH=$(PWD)/Godeps/_workspace:$GOPATH make binaries
  2. $ sudo mkdir -p /usr/local/libexec
  3. $ sudo cp bin/registry /usr/local/libexec/registry

Setup

Copy the registry configuration file in place:

  1. $ mkdir /Users/Shared/Registry
  2. $ cp docs/osx/config.yml /Users/Shared/Registry/config.yml

Run the registry under launchd

Copy the registry plist into place:

  1. $ plutil -lint docs/recipes/osx/com.docker.registry.plist
  2. $ cp docs/recipes/osx/com.docker.registry.plist ~/Library/LaunchAgents/
  3. $ chmod 644 ~/Library/LaunchAgents/com.docker.registry.plist

Start the registry:

  1. $ launchctl load ~/Library/LaunchAgents/com.docker.registry.plist

Restart the registry service

  1. $ launchctl stop com.docker.registry
  2. $ launchctl start com.docker.registry

Unload the registry service

  1. $ launchctl unload ~/Library/LaunchAgents/com.docker.registry.plist