2015-06-08 00:58:53 +00:00
<!-- [metadata]>
+++
2015-08-28 19:46:09 +00:00
title = "Running on OS X"
description = "Explains how to run a registry on OS X"
keywords = ["registry, on-prem, images, tags, repository, distribution, OS X, recipe, advanced"]
2015-06-08 00:58:53 +00:00
+++
<![end-metadata]-->
2015-04-27 01:38:34 +00:00
# OS X Setup Guide
2015-08-26 18:08:13 +00:00
## Use-case
2015-08-28 19:46:09 +00:00
This is useful if you intend to run a registry server natively on OS X.
2015-08-26 18:08:13 +00:00
### Alternatives
2015-08-28 19:46:09 +00:00
You can start a VM on OS X, and deploy your registry normally as a container using Docker inside that VM.
2015-08-26 18:08:13 +00:00
The simplest road to get there is traditionally to use the [docker Toolbox ](https://www.docker.com/toolbox ), or [docker-machine ](https://docs.docker.com/machine/ ), which usually relies on the [boot2docker ](http://boot2docker.io/ ) iso inside a VirtualBox VM.
### Solution
2015-08-28 19:46:09 +00:00
Using the method described here, you install and compile your own from the git repository and run it as an OS X agent.
2015-08-26 18:08:13 +00:00
### Gotchas
2015-08-28 19:46:09 +00:00
Production services operation on OS X is out of scope of this document. Be sure you understand well these aspects before considering going to production with this.
2015-08-26 18:08:13 +00:00
## Setup golang on your machine
If you know, safely skip to the next section.
If you don't, the TLDR is:
bash < < (curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
source ~/.gvm/scripts/gvm
gvm install go1.4.2
gvm use go1.4.2
If you want to understand, you should read [How to Write Go Code ](https://golang.org/doc/code.html ).
2015-04-27 01:38:34 +00:00
## Checkout the Docker Distribution source tree
2015-08-26 18:08:13 +00:00
mkdir -p $GOPATH/src/github.com/docker
git clone https://github.com/docker/distribution.git $GOPATH/src/github.com/docker/distribution
cd $GOPATH/src/github.com/docker/distribution
2015-04-27 01:38:34 +00:00
2015-08-26 18:08:13 +00:00
## Build the binary
2015-04-27 01:38:34 +00:00
2015-08-26 18:08:13 +00:00
GOPATH=$(PWD)/Godeps/_workspace:$GOPATH make binaries
sudo cp bin/registry /usr/local/libexec/registry
2015-04-27 01:38:34 +00:00
## Setup
Copy the registry configuration file in place:
2015-08-26 18:08:13 +00:00
mkdir /Users/Shared/Registry
cp docs/osx/config.yml /Users/Shared/Registry/config.yml
2015-04-27 01:38:34 +00:00
## Running the Docker Registry under launchd
Copy the Docker registry plist into place:
2015-08-26 18:08:13 +00:00
plutil -lint docs/osx/com.docker.registry.plist
cp docs/osx/com.docker.registry.plist ~/Library/LaunchAgents/
chmod 644 ~/Library/LaunchAgents/com.docker.registry.plist
2015-04-27 01:38:34 +00:00
Start the Docker registry:
2015-08-26 18:08:13 +00:00
launchctl load ~/Library/LaunchAgents/com.docker.registry.plist
2015-04-27 01:38:34 +00:00
### Restarting the docker registry service
2015-08-26 18:08:13 +00:00
launchctl stop com.docker.registry
launchctl start com.docker.registry
2015-04-27 01:38:34 +00:00
### Unloading the docker registry service
2015-08-26 18:08:13 +00:00
launchctl unload ~/Library/LaunchAgents/com.docker.registry.plist