2

我正在尝试初始化我的 docker arangodb,但不断收到连接错误:我尝试将服务器端点更改为 http+tcp://..... 但错误仍然存​​在,会发生什么?

码头工人-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

非常感谢

4

1 回答 1

1

8999为您的服务器端点使用端口

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

这适用于我 3.6.2。

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

于 2020-03-29T03:57:06.247 回答