Skip to content

Commit

Permalink
Name the registry a special kcl-registry instead of a common registry.
Browse files Browse the repository at this point in the history
Signed-off-by: Lan Liang <gcslyp@gmail.com>
  • Loading branch information
liangyuanpeng committed Aug 2, 2024
1 parent 8e479b3 commit 333f5b4
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions scripts/e2e/reg.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
#!/bin/bash

# create a directory to store user passwords
mkdir -p ./scripts/e2e/registry_auth
mkdir -p ./scripts/registry_auth

# use htpasswd to create an encrypted file
htpasswd -Bbn test 1234 > ./scripts/e2e/registry_auth/htpasswd
htpasswd -Bbn test 1234 > ./scripts/registry_auth/htpasswd

# check if there is a container named registry
if [ "$(docker ps -aq -f name=registry)" ]; then
if [ "$(docker ps -aq -f name=kcl-registry)" ]; then
# stop and remove the container named registry
docker stop registry
docker rm registry
docker stop kcl-registry
docker rm kcl-registry
fi
export KCL_REGISTRY_PORT=${KCL_REGISTRY_PORT:-"5001"}

# start the Docker Registry with authentication
docker run -p 5001:5000 \
docker run -p ${KCL_REGISTRY_PORT}:5000 \
--restart=always \
--name registry \
--name kcl-registry \
-v /var/lib/registry:/var/lib/registry \
-v $PWD/scripts/e2e/registry_auth/:/auth/ \
-v $PWD/scripts/registry_auth/:/auth/ \
-e "REGISTRY_AUTH=htpasswd" \
-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
-e "REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd" \
-d registry

# clean the registry
docker exec registry rm -rf /var/lib/registry/docker/registry/v2/repositories/
docker exec kcl-registry rm -rf /var/lib/registry/docker/registry/v2/repositories/

0 comments on commit 333f5b4

Please sign in to comment.