I am using a base docker image of Ubuntu 18.04 plus MySQL (have tried with MariaDb as well)
I created a local folder ‘SQL’ in my home directory
Copied my xyz.SQL file into this folder.
I ran 'chmod 777 sql ’ command on this folder to give full permissions to all
I created a volume in docker-compose using ‘Volume’ command
then I ran command ‘docker-compose up’
I see the database created using ‘docker exec -it my_container bin/bash’
but not tables in database even after creating volumes
I ran below commands to create volume seperately
''docker volume create [OPTIONS] [VOLUME]
docker run --volume,type=bind,source=/path_in,dest=/container_path"
but it was creating folders only
Database is created when base image of mysql is build
Under mysql image there is pre-defined variable which is ‘MYSQL-DATABASE’ : my_db_name
I expect this .SQL file to be sourced and create schema and some initial data. Instructions for the same are in my dockerfile.(attached below)
I am unable to source my ‘.SQL’ file. Although I believe the database is accessible as such.
What am I doing wrong?