forked from opendns/registry-oauth-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartdemo.sh
executable file
·35 lines (28 loc) · 938 Bytes
/
startdemo.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
#!/bin/bash
username="admin"
pass="password"
cred="${username}:${pass}"
encoded_cred=`echo -n ${cred} | base64`
service="demo_registry"
if [ "$(uname)" == "Darwin" ]; then
docker_ip="$(docker-machine ip default)"
else
docker_ip="0.0.0.0"
fi
echo
echo "curl https://${docker_ip}:5000/v2/_catalog"
echo
curl -skv "https://${docker_ip}:5000/v2/_catalog"
read input
clear
echo
echo "curl http://${docker_ip}:8080/tokens?service=${service}&scope=registry:catalog:*"
echo
curl -sv -H "Authorization: Basic ${encoded_cred}" "http://${docker_ip}:8080/tokens?service=${service}&scope=registry:catalog:*"
token=`curl -s -H "Authorization: Basic ${encoded_cred}" "http://${docker_ip}:8080/tokens?service=${service}&scope=registry:catalog:*" | jq .token | tr -d '"'`
read input
clear
echo
echo "curl \"https://${docker_ip}:5000/v2/_catalog\""
curl -skv -H "Authorization: Bearer ${token}" "https://${docker_ip}:5000/v2/_catalog"
echo