Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
feat(docker registry): add Vagrantfile for Docker registry
Browse files Browse the repository at this point in the history
Adds a contrib/docker-registry directory with a Vagrantfile that
configures and starts a VM with the Docker registry service.
  • Loading branch information
carmstrong committed Jun 5, 2014
1 parent 82c2a0d commit 7199d88
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
14 changes: 14 additions & 0 deletions contrib/docker-registry/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Private Docker registry
=======================

This directory provides a Vagrantfile and user-data file to provision and configure a CoreOS machine
which runs a private Docker registry. This is useful for testing Deis because it is significantly
faster than the public Docker registry.

To run the registry, in this directory simply:
```console
$ vagrant up
```

The registry will then be accessible at `172.21.12.100:5000` from any other local VM, including
Deis machines.
38 changes: 38 additions & 0 deletions contrib/docker-registry/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# -*- mode: ruby -*-
# # vi: set ft=ruby :

Vagrant.configure("2") do |config|
config.vm.box = "coreos-alpha"
config.vm.box_url = "http://alpha.release.core-os.net/amd64-usr/current/coreos_production_vagrant.json"

config.vm.provider :vmware_fusion do |vb, override|
override.vm.box_url = "http://alpha.release.core-os.net/amd64-usr/current/coreos_production_vagrant_vmware_fusion.json"
end

config.vm.provider :virtualbox do |vb, override|
# Fix docker not being able to resolve private registry in VirtualBox
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end

config.vm.provider :virtualbox do |v|
# On VirtualBox, we don't have guest additions or a functional vboxsf
# in CoreOS, so tell Vagrant that so it can be smarter.
v.check_guest_additions = false
end

# plugin conflict
if Vagrant.has_plugin?("vagrant-vbguest") then
config.vbguest.auto_update = false
end

config.vm.define vm_name = 'docker-registry' do |config|
config.vm.hostname = 'docker-registry'
config.vm.network :private_network, ip: "172.21.12.100"

# user-data bootstrapping
config.vm.provision :file, :source => "user-data", :destination => "/tmp/vagrantfile-user-data"
config.vm.provision :shell, :inline => "mv /tmp/vagrantfile-user-data /var/lib/coreos-vagrant/", :privileged => true
end

end
13 changes: 13 additions & 0 deletions contrib/docker-registry/user-data
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#cloud-config
---
coreos:
units:
- name: docker-registry.service
command: start
content: |
[Unit]
Description=Docker Registry server

[Service]
ExecStartPre=/bin/sh -c "docker history registry:latest >/dev/null || docker pull registry:latest"
ExecStart=/usr/bin/docker run --name docker-registry -e STORAGE_PATH=/registry -e SEARCH_BACKEND=sqlalchemy -p 5000:5000 registry:latest

0 comments on commit 7199d88

Please sign in to comment.