k8s-lab/k3s/rpi/dev-stuff/registry/gen_pass.sh

18 lines
619 B
Bash
Raw Normal View History

2025-06-21 20:36:29 +00:00
#!/bin/bash
# Make sure to export the variables REGISTRY_USER and REGISTRY_PASS with your actual credentials
# before running the script.
export DESTINATION_FOLDER=./registry-creds
# Backup credentials to local files (in case you'll forget them later on)
mkdir -p ${DESTINATION_FOLDER}
echo ${REGISTRY_USER} >> ${DESTINATION_FOLDER}/registry-user.txt
echo ${REGISTRY_PASS} >> ${DESTINATION_FOLDER}/registry-pass.txt
docker run --entrypoint htpasswd registry:2.7.0 \
-Bbn ${REGISTRY_USER} ${REGISTRY_PASS} \
> ${DESTINATION_FOLDER}/htpasswd
unset REGISTRY_USER REGISTRY_PASS DESTINATION_FOLDER