forked from containerd/accelerated-container-image
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Bowei Zhuang <[email protected]>
- Loading branch information
1 parent
a03d841
commit b1f14b6
Showing
8 changed files
with
146 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/bin/bash | ||
# | ||
# run a HTTPS registry | ||
|
||
set -x | ||
|
||
rm -rf /etc/registry/ | ||
mkdir -p /etc/registry/certs/ | ||
mkdir -p /etc/registry/config/ | ||
|
||
# generate server certifications | ||
cat << EOF > /etc/registry/openssl.cnf | ||
[req] | ||
distinguished_name = req_distinguished_name | ||
x509_extensions = v3_req | ||
prompt = no | ||
[req_distinguished_name] | ||
C = CN | ||
ST = Beijing | ||
L = Beijing City | ||
O = Alibaba | ||
CN = localhost | ||
[v3_req] | ||
basicConstraints = CA:FALSE | ||
keyUsage = nonRepudiation, digitalSignature, keyEncipherment | ||
subjectAltName = @alt_names | ||
[alt_names] | ||
DNS.1 = localhost | ||
IP.1 = 127.0.0.1 | ||
EOF | ||
|
||
openssl req -new -x509 -newkey rsa:2048 -sha256 -nodes -config /etc/registry/openssl.cnf \ | ||
-days 365 -out /etc/registry/certs/server.crt -keyout /etc/registry/certs/server.key | ||
|
||
ls /etc/registry/certs/ | ||
cp /etc/registry/certs/server.crt /usr/local/share/ca-certificates/registry.crt | ||
update-ca-certificates | ||
|
||
# start registry | ||
cat << EOF > /etc/registry/config/config.yml | ||
version: 0.1 | ||
log: | ||
fields: | ||
service: registry | ||
storage: | ||
cache: | ||
blobdescriptor: inmemory | ||
filesystem: | ||
rootdirectory: /var/lib/registry | ||
http: | ||
addr: :5000 | ||
headers: | ||
X-Content-Type-Options: [nosniff] | ||
tls: | ||
certificate: /certs/server.crt | ||
key: /certs/server.key | ||
health: | ||
storagedriver: | ||
enabled: true | ||
interval: 10s | ||
threshold: 3 | ||
EOF | ||
|
||
docker run -d --restart=always --name registry -p 127.0.0.1:5000:5000 \ | ||
-v /etc/registry/certs:/certs \ | ||
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/server.crt \ | ||
-e REGISTRY_HTTP_TLS_KEY=/certs/server.key \ | ||
registry:2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
from=${1:?} | ||
to=${2:?} | ||
|
||
set -x | ||
|
||
ctr i pull "${from}" | ||
ctr i tag "${from}" "${to}" | ||
ctr i push "${to}" | ||
ctr i rm "${from}" "${to}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
# | ||
# rpull and run on-demand | ||
|
||
image=$1 | ||
container_name=${2:-test} | ||
|
||
/opt/overlaybd/snapshotter/ctr rpull "${image}" | ||
ctr run -d --net-host --snapshotter=overlaybd "${image}" "${container_name}" | ||
ctr t ls | grep "${container_name}" | ||
ctr t kill -s 9 "${container_name}" && sleep 5s && ctr t ls | ||
ctr c rm "${container_name}" && ctr c ls | ||
ctr i rm "${image}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters