Skip to content

Commit e472c54

Browse files
committed
Merge pull request #1135 from deis/feat-local_registry
feat(docker registry): add Vagrantfile for Docker registry
2 parents 651e6d4 + 69eb0af commit e472c54

3 files changed

Lines changed: 66 additions & 0 deletions

File tree

contrib/docker-registry/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Private Docker registry
2+
=======================
3+
4+
This directory provides a Vagrantfile and user-data file to provision and configure a CoreOS machine
5+
which runs a private Docker registry. This is useful for testing Deis because it is significantly
6+
faster than the public Docker registry.
7+
8+
To run the registry, in this directory simply:
9+
```console
10+
$ vagrant up
11+
```
12+
13+
The registry will then be accessible at `172.21.12.100:5000` from any other local VM, including
14+
Deis machines.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# -*- mode: ruby -*-
2+
# # vi: set ft=ruby :
3+
4+
Vagrant.configure("2") do |config|
5+
config.vm.box = "coreos-alpha"
6+
config.vm.box_url = "http://alpha.release.core-os.net/amd64-usr/current/coreos_production_vagrant.json"
7+
8+
config.vm.provider :vmware_fusion do |vb, override|
9+
override.vm.box_url = "http://alpha.release.core-os.net/amd64-usr/current/coreos_production_vagrant_vmware_fusion.json"
10+
end
11+
12+
config.vm.provider :virtualbox do |vb, override|
13+
# Fix docker not being able to resolve private registry in VirtualBox
14+
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
15+
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
16+
end
17+
18+
config.vm.provider :virtualbox do |v|
19+
# On VirtualBox, we don't have guest additions or a functional vboxsf
20+
# in CoreOS, so tell Vagrant that so it can be smarter.
21+
v.check_guest_additions = false
22+
end
23+
24+
# plugin conflict
25+
if Vagrant.has_plugin?("vagrant-vbguest") then
26+
config.vbguest.auto_update = false
27+
end
28+
29+
config.vm.define vm_name = 'docker-registry' do |config|
30+
config.vm.hostname = 'docker-registry'
31+
config.vm.network :private_network, ip: "172.21.12.100"
32+
33+
# user-data bootstrapping
34+
config.vm.provision :file, :source => "user-data", :destination => "/tmp/vagrantfile-user-data"
35+
config.vm.provision :shell, :inline => "mv /tmp/vagrantfile-user-data /var/lib/coreos-vagrant/", :privileged => true
36+
end
37+
38+
end

contrib/docker-registry/user-data

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#cloud-config
2+
---
3+
coreos:
4+
units:
5+
- name: docker-registry.service
6+
command: start
7+
content: |
8+
[Unit]
9+
Description=Docker Registry server
10+
11+
[Service]
12+
TimeoutStartSec=10min
13+
ExecStartPre=/bin/sh -c "docker history registry:latest >/dev/null || docker pull registry:latest"
14+
ExecStart=/usr/bin/docker run --name docker-registry -e STORAGE_PATH=/registry -e SEARCH_BACKEND=sqlalchemy -p 5000:5000 registry:latest

0 commit comments

Comments
 (0)