I am running a rethinkdb
alongside a .NET Core App
using docker-compose
.
Is there any way so that i can set up 2 tables for rethinkdb
and some secondary indexes?
Can Rethinkdb
be configured (set up a db
,table
) directly with a bash command?
docker-compose
version: "3.3"
services:
rethink:
restart: always
image: rethinkdb:2.3.6
container_name: rethink0
ports: //i want to create a db,a table and a secondary index after set up
- 8080:8080
networks:
- ret-net
mp:
build: ./mpserver
image: mp
restart: always
container_name: mp0
depends_on:
- rethink
ports:
- 8203:8202
networks:
- ret-net
networks:
ret-net:
your best option is to setup the python driver and then you can run commands as bash script
sudo pip install rethinkdb
import rethinkdb as r
r.connect('localhost',28015).repl()
r.db_create('test').run()
r.db('test').table_create('myTable').run()
you can also consider building a docker image that includes this driver, i think the official image does not include it.
I cannot tell you confidently how to build a docker container like this, but based on this description it should be something like:
FROM library/rethinkdb
apt-get update &&
apt-get install -y python-pip &&
RUN pip install rethinkdb
.. and the you can execute the creation commands from inside the docker container
docker exec -it <container name> <command>