Try running the mysql 5.7 image with the datadir flag and include the bash script in the CMD.
CMD ["--datadir=/data ; sh db_translations.sh"]
What ends up happening is that the container runs and creates a folder called data for mysql; sh db_translations.sh
. Any idea why this is happening?
While many containers treat
bash
/sh
asENTRYPOINT
and this works, for mysql containers,>ENTRYPOINT
Already a script, it will only accept the providedCMD
and will notre-evaluate
in script form.See using
/docker-entrypoint-initdb.d
as the script location for each document - https://hub.docker.com/_/mysql, although you may need Reorganized scripts and environments.