Orientdb 无法在 docker 容器内插入数据

Orientdb cannot insert data inside docker container

我正在使用docker来使用orientdb。在我的本地主机中使用我设法使用

将数据插入数据库
OServerAdmin serverAdmin = new OServerAdmin("remote:localhost:2424").connect("root","password");

但是,当我尝试使用 docker 容器做同样的事情时,我设法连接创建了数据库,但我无法插入我的数据

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

关于为什么我可以使用 API 连接和创建数据库但不能插入任何数据的任何想法?

编辑:

我 运行 console.sh 并像这样连接到我的 docker 容器 CONNECT remote:172.17.0.2:2424/CartoesPagamentos 根密码 我尝试插入一个顶点,但成功了。

你确定

OrientGraph graph = factory.getTx();

有效吗?

您可以通过浏览器访问 orientDb admin ui 这个地址 172.17.0.2 吗? 您还可以通过下一个命令检查 orientDb docker 日志:

docker logs -f {container name or hash}

关于如何 运行 orientDB docker 容器的文档:

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

你是运行这个命令:

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

你没有向本地主机公开端口,而且你似乎提供了一个配置文件夹作为卷:如文档页面所述,如果你提供(也称为覆盖)一个空的配置文件夹,orient 将从一个非常小的配置。

所以,请仔细阅读上面链接的文档并阅读 docker 文档。