Search code examples
javaapidockerorientdbnosql

Orientdb cannot insert data inside docker container


I am using docker to use orientdb. Using in my localhost i managed to insert data to the database using

OServerAdmin serverAdmin = new OServerAdmin("remote:localhost:2424").connect("root","password");

However, when i try to do the same thing using docker container i manage to connect create the database but i cannot insert my data

OrientGraphFactory factory = new OrientGraphFactory("remote:172.17.0.2:2424/CartoesPagamentos").setupPool(1,10);
OrientGraph graph = factory.getTx();

Any ideas about why I can connect and create a database using the API but cannot insert any data?

EDIT :

I ran console.sh and connected to my docker container like this CONNECT remote:172.17.0.2:2424/CartoesPagamentos root password and i tried to insert a vertex and it worked.


Solution

  • Documentation about how to run the orientDB docker container:

    https://hub.docker.com/_/orientdb/

    You are running with this command:

    docker run --name cartoesPagamentoTeste -v /orientdb/config -it orient db:latest server.sh

    you're not exposing ports to localhost and it seems you are providing a config folder as volume: as stated on the doc page, if you provide (aka override) a config folder that is empty, orient will start with a very minimal configuration.

    So, please, read docs linked above carefully AND read docker docs.