I have a docker-compose.yml file with the tidb container setup like this
ti-db:
image: pingcap/tidb
container_name: ti-db
ports:
- 4000:4000
logging:
driver: none
volumes:
- ./storage/tidb:/var/lib/mysql
I am trying to have it create a database called "messageservice" on startup but cannot get it to work.
In the same docker-compose file I have a mysql container where I create initial databases using init.sql file and mapping it to docker-entrypoint-initdb.d like this
- ./dbInit/init.sql:/docker-entrypoint-initdb.d/init.sql
But when I do the same thing for TiDb it does not work.
Is there a way I can setup the docker-compose file so the database gets created on docker compose up command ?
And what do you have on file init.sql?
Or you can try without the file by using "command"