Hello,
I am able to pull the YB image and run a container, able to do YSQLSH and execute Create DB, Create Schema and query tables, its all good. But I do have a requirement to run all these,
- Create the DB
- Create the sample Schemas
- Insert the data into those sample table.
in a script file. So that, when my developer pull my image and run a container, which should pull my script file during the container creation, it will get the DB and Schema ready for them. So that they do not have to run multiple commands in it.
I was able to login to this DB directly this way.
docker container exec -it imgyb1cont1 /home/yugabyte/bin/ysqlsh “yb_demo”
But again, to do this, the DB should exist before. which will not happen unless I issue CREATE DATABASE COMMAND.
Please help.
Also I am thinking to put together the Explore YSQL, the Yugabyte SQL API | YugabyteDB Docs the SQL Queries in a file such as ybinit.sql and want to call that when creating a container. But how can I get directly connected to ysqlsh and run the sql file?