我正在尝试初始化我的docker arangodb,但一直出现连接错误:我尝试将服务器端点更改为http + tcp:// .....,但错误仍然存​​在,这可能是怎么回事?

docker-compose.yml:

version: '3.3'
services:
  db:
    container_name: arangodb
    build: .
    environment:
      - ARANGO_DB_NAME="mydba"
      - ARANGO_DB_USER="user"
      - ARANGO_DB_PASSWORD="123"
    ports:
      - '2010:8529'
    expose:
      - '2010'
    volumes:
      - ./arango-dump:/docker-entrypoint-initdb.d

Dockerfile:
FROM arangodb
## Environment variables
ENV ARANGO_ROOT_PASSWORD=123

arango-dump / 01-Create.sh:
#!/bin/bash
/usr/bin/arangosh \
--server.endpoint=unix:///tmp/arangodb-tmp.sock \
--server.password ${ARANGO_ROOT_PASSWORD} \
--javascript.execute-string "db._createDatabase(${ARANGO_DB_NAME}, [{username: ${ARANGO_DB_USER}, password: ${ARANGO_DB_PASSWORD}}]);"

错误:
arangodb | /entrypoint.sh: running /docker-entrypoint-initdb.d/01-Create.sh
arangodb | 2020-03-25T03:49:52Z [255] ERROR [979b9] JavaScript exception in file '/usr/share/arangodb3/js/client/modules/@arangodb/arango-database.js' at 1017,40: ArangoError 2001: not connected\n!  var requestResult = this._connection.POST('/_api/database', data);\n!                                       ^\nstacktrace: ArangoError: not connected\n    at Proxy.ArangoDatabase._createDatabase (/usr/share/arangodb3/js/client/modules/@arangodb/arango-database.js:1017:40)\n    at (command-line):1:4\n
arangodb exited with code 1

非常感谢

最佳答案

使用8999端口作为服务器端点

--server.endpoint=tcp://127.0.0.1:8999

这适用于我3.6.2。

在您的情况下,不需要Dockerfile,也不需要expose中的docker-compose.yml

关于docker - docker-entrypoint-initdb.d上的Arangodb连接失败,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/60857569/

10-15 22:26