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?
P粉0717437322024-03-31 09:06:30
While many containers treat bash
/sh
as ENTRYPOINT
and this works, for mysql containers, >ENTRYPOINT
Already a script, it will only accept the provided CMD
and will not re-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.