-
Notifications
You must be signed in to change notification settings - Fork 3
/
config-registry.sh
executable file
·49 lines (38 loc) · 1.01 KB
/
config-registry.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
#!/usr/bin/env bash
. $(dirname $0)/demo.conf
[[ $EUID -ne 0 ]] && exit_on_error "Must run as root"
[[ "$REGISTRYINSECURE" != "true" ]] && exit_on_error "Only run this for an insecure registry"
#
# Setup for a local insecure registry
#
firewall-cmd --permanent --add-port=$REGISTRYPORT/tcp
firewall-cmd --reload
cat > /etc/containers/registries.conf.d/999-local-registry.conf <<EOF
[[registry]]
location = "$HOSTIP:$REGISTRYPORT"
insecure = true
EOF
# make local copy for later container build
cp /etc/containers/registries.conf.d/999-local-registry.conf .
#
# Create quadlet for registry service
#
mkdir -p /var/lib/registry
cat > /etc/containers/systemd/local-registry.container <<EOF
[Unit]
Description=A simple local registry
[Container]
Image=docker.io/library/registry:2
ContainerName=registry
PublishPort=$REGISTRYPORT:5000
Volume=/var/lib/registry:/var/lib/registry:Z
[Service]
Restart=always
[Install]
WantedBy=default.target
EOF
#
# Launch the local registry
#
systemctl daemon-reload
systemctl start local-registry