I see that I can initialize a DB by putting a SQL file in /docker-entrypoint-initdb.d, but I think that means I have to mount a volume there . . . I think an easier way is to have an initContainer put the SQL file on the same volume as the DB, but that requires changing docker-entrypoint.sh to allow for $DATADIR/mysql/some-directory as a dir for SQL files, which requires creating a new, custom, container . . . does this sound like a bad idea? Is there better way? Thanks!!
Is my question not clear ?
Yes, maybe you should give more context and describe what your goal is and what you are doing.
Thanks! I would like to initialize a DB on startup of the container . . . I think that functionality already exists, and one can put a sql file in /docker-entrypoint-initdb.d on the container and it will get imported into the DB.
Getting the SQL file in /docker-entrypoint-initdb.d is a bit of a pain for me, though. I would prefer if docker-entrypoint.sh looked for the SQL init file on my PersistentVolume, where my database files will reside.
Is this an anti-pattern? Am I thinking about this the wrong way? Thanks again!!