Dockerfile CMD does not support multiple commands for mysql image
P粉217784586
P粉217784586 2024-03-30 11:20:42
0
1
406

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粉217784586
P粉217784586

reply all(1)
P粉071743732

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template