Files
michaelschiemer/docker/portainer/init-admin.sh

17 lines
505 B
Bash

#!/bin/sh
# Portainer Admin Password Init Script
# Creates bcrypt hash of admin password for Portainer
if [ -z "$PORTAINER_ADMIN_PASSWORD" ]; then
echo "Error: PORTAINER_ADMIN_PASSWORD environment variable not set"
exit 1
fi
# Create bcrypt hash of password
# Note: Portainer uses bcrypt cost 10
apk add --no-cache apache2-utils
htpasswd -nbB admin "$PORTAINER_ADMIN_PASSWORD" | cut -d ":" -f 2 > /tmp/portainer_password
echo "Portainer admin password hash created"
cat /tmp/portainer_password