forked from nemonik/hands-on-DevOps-gen2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·55 lines (36 loc) · 1.5 KB
/
install.sh
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
# Copyright (C) 2021 Michael Joseph Walsh - All Rights Reserved
# You may use, distribute and modify this code under the
# terms of the the license.
#
# You should have received a copy of the license with
# this file. If not, please email <mjwalsh@nemonik.com>
set -e
set -a
skip_encrypted_variables=true
. ../.env
if [ "${pullthrough_registry_enabled}" = "true" ]; then
if [ $( docker ps | grep ${pullthrough_registry_name} | wc -l ) -gt 0 ]; then
notify "pullthrough registry is already running."
elif [ $( docker ps --filter "status=exited" | grep ${pullthrough_registry_name} | wc -l ) -gt 0 ]; then
notify "pullthrough registry already exists, but is stopped. Restarting..."
docker start ${pullthrough_registry_name} >/dev/null 2>&1
else
notify "Creating pullthrough registry at localhost:${pullthrough_registry_port}"
template_file ./templates/registries.yaml.tpl registries.yaml
cmd="docker run --detach --volume $(pwd)/config.yml:/etc/docker/registry/config.yml --name ${pullthrough_registry_name} --publish ${pullthrough_registry_port}:5000/tcp registry:2 > /dev/null"
echo $cmd
eval "${cmd}"
notify "Now running..."
fi
echo
notify "Ensure your docker daemon configure file contains:"
echo
notify " {..."
notify " \"registry-mirrors\": [\"http://host.k3d.internal:${pullthrough_registry_port}\"],"
notify " ...}"
echo
notify "to use use your pullthrough registry."
else
notify "Pullthrough registry not enabled."
fi