2016-09-29 21:21:06 +02:00
---
2016-10-18 00:00:00 +02:00
description: Explains how to run a registry on macOS
2016-11-10 20:54:25 +01:00
keywords: registry, on-prem, images, tags, repository, distribution, macOS, recipe, advanced
2017-08-23 01:43:21 +02:00
title: macOS setup guide
2016-09-29 21:21:06 +02:00
---
2016-09-28 23:46:28 +02:00
2020-07-03 16:25:54 +02:00
{% include registry.md %}
2016-09-28 23:46:28 +02:00
## Use-case
2016-10-18 00:00:00 +02:00
This is useful if you intend to run a registry server natively on macOS.
2016-09-28 23:46:28 +02:00
### Alternatives
2016-10-18 00:00:00 +02:00
You can start a VM on macOS, and deploy your registry normally as a container using Docker inside that VM.
2016-09-28 23:46:28 +02:00
### Solution
2016-10-18 00:00:00 +02:00
Using the method described here, you install and compile your own from the git repository and run it as an macOS agent.
2016-09-28 23:46:28 +02:00
### Gotchas
2016-10-18 00:00:00 +02:00
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.
2016-09-28 23:46:28 +02: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 ).
## Checkout the Docker Distribution source tree
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
## Build the binary
GOPATH=$(PWD)/Godeps/_workspace:$GOPATH make binaries
2017-08-24 01:34:49 +02:00
sudo mkdir -p /usr/local/libexec
2016-09-28 23:46:28 +02:00
sudo cp bin/registry /usr/local/libexec/registry
## Setup
Copy the registry configuration file in place:
mkdir /Users/Shared/Registry
cp docs/osx/config.yml /Users/Shared/Registry/config.yml
2017-08-23 01:43:21 +02:00
## Run the Docker Registry under launchd
2016-09-28 23:46:28 +02:00
Copy the Docker registry plist into place:
2017-08-24 01:34:49 +02:00
plutil -lint registry/recipes/osx/com.docker.registry.plist
cp registry/recipes/osx/com.docker.registry.plist ~/Library/LaunchAgents/
2016-09-28 23:46:28 +02:00
chmod 644 ~/Library/LaunchAgents/com.docker.registry.plist
Start the Docker registry:
launchctl load ~/Library/LaunchAgents/com.docker.registry.plist
2017-08-23 01:43:21 +02:00
### Restart the docker registry service
2016-09-28 23:46:28 +02:00
launchctl stop com.docker.registry
launchctl start com.docker.registry
2017-08-23 01:43:21 +02:00
### Unload the docker registry service
2016-09-28 23:46:28 +02:00
2017-06-02 18:59:46 +02:00
launchctl unload ~/Library/LaunchAgents/com.docker.registry.plist