#!/bin/bash # if there is no admin user in mysql yet, create it and run some other preparations as this is the first start # of this container service mysql start if ! echo "SELECT User FROM mysql.user WHERE User='admin';" | mysql | grep -q "admin"; then if [ -z "$DEFAULTPW" ]; then DEFAULTPW='jdpasswd' fi # create admin user in mysql echo "CREATE USER 'admin'@'localhost' IDENTIFIED BY '${DEFAULTPW}';" | mysql echo "GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;" | mysql echo "FLUSH PRIVILEGES;" | mysql # set password for jdoe user echo "jdoe:${DEFAULTPW}" | chpasswd fi service apache2 start service ssh start /bin/bash