yobasystems / alpine-mariadb

MariaDB running on Alpine Linux [Docker]
https://hub.docker.com/r/yobasystems/alpine-mariadb/
237 stars 71 forks source link

run.sh does not have an sh handler for docker-entrypoint-initdb.d #76

Closed dwidge closed 1 month ago

dwidge commented 1 month ago

https://github.com/yobasystems/alpine-mariadb/blob/fc502931629007245d1fad5249b88e3995012eab/alpine-mariadb-amd64/files/run.sh#L98

https://hub.docker.com/r/yobasystems/alpine-mariadb Furthermore, it will execute files with extensions .sh, .sql and .sql.gz that are found in /docker-entrypoint-initdb.d.

dominictayloruk commented 1 month ago

If you could be more specific?

dwidge commented 1 month ago

Readme says we can put .sh files in /docker-entrypoint-initdb.d, but it seems to handle only .sql and .sql.gz. https://github.com/yobasystems/alpine-mariadb/blob/fc502931629007245d1fad5249b88e3995012eab/README.md?plain=1#L183

for f in /docker-entrypoint-initdb.d/*; do
    case "$f" in
        *.sql)    echo "  $0: running $f"; eval "${MYSQL_CLIENT} ${MYSQL_DATABASE} < $f"; echo ;;
        *.sql.gz) echo "  $0: running $f"; gunzip -c "$f" | eval "${MYSQL_CLIENT} ${MYSQL_DATABASE}"; echo ;;
    esac
done

I have an sh in /docker-entrypoint-initdb.d with an echo, but not running:

db-1  | Preparing to process the contents of /docker-entrypoint-initdb.d/
db-1  |
db-1  | Completed processing seed files.

I tried /scripts/pre-init.d/ and /scripts/pre-exec.d/ and it runs the sh.

dominictayloruk commented 1 month ago

You answered your own question, the section in the /docker-entrypoint-initdb.d is for running .sql/.sql.gz backups.

Scripts go in pre initialisation or pre execution.

dwidge commented 1 month ago

Thank you!