-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
41 lines (37 loc) · 1.19 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Vagrant.configure(2) do |config|
config.vm.box = "bento/ubuntu-14.04"
config.vm.hostname = "registry.local"
# https://github.com/smdahlen/vagrant-hostmanager/issues/86
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.include_offline = true
cached_addresses = {}
config.hostmanager.ip_resolver = proc do |vm, resolving_vm|
if cached_addresses[vm.name].nil?
if hostname = (vm.ssh_info && vm.ssh_info[:host])
vm.communicate.execute("ip -f inet -o addr show eth1") do |type, contents|
cached_addresses[vm.name] = contents.split()[3][/[^\/]+/]
end
end
end
cached_addresses[vm.name]
end
config.vm.network :private_network, type: "dhcp"
config.vm.provision "shell" do |sh|
sh.inline = <<-EOF
if [ ! -d "/data" ]; then
mkdir /data
fi
if [ ! -f "/data/insecure_config.yml" ]; then
cp /vagrant/insecure_config.yml /data
fi
EOF
end
config.vm.provision "docker" do |docker|
docker.run "v2-mirror",
image: "registry:2.2.1",
cmd: "/var/lib/registry/insecure_config.yml",
daemonize: true,
args: "-p 80:5000 -v /data:/var/lib/registry"
end
end