-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name the registry a special kcl-registry instead of a common registry.
Signed-off-by: Lan Liang <gcslyp@gmail.com>
- Loading branch information
1 parent
8e479b3
commit 333f5b4
Showing
1 changed file
with
10 additions
and
9 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
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/ |