Mongo Express码头工人

时间:2018-09-28 19:26:01

标签: mongodb docker

我已使用ubuntu 14.04 LTS在我的plesk服务器上设置了mongodb docker映像。 关于mongo一切都很好。我可以从外壳和机器人3t访问。我需要使用mongo express从基于Web的界面管理mongo db。

enter image description here 我将可变性设置为如图所示,但是我在日志中遇到了这些问题,并且无法访问Web界面。

Waiting for mongo:27017...
Fri Sep 28 19:22:57 UTC 2018 retrying to connect to mongo:27017 (2/5)
Fri Sep 28 19:23:03 UTC 2018 retrying to connect to mongo:27017 (3/5)
Fri Sep 28 19:23:09 UTC 2018 retrying to connect to mongo:27017 (4/5)
Fri Sep 28 19:23:15 UTC 2018 retrying to connect to mongo:27017 (5/5)
Welcome to mongo-express
------------------------


Mongo Express server listening at http://0.0.0.0:8081
/docker-entrypoint.sh: line 14: mongo: Try again
/docker-entrypoint.sh: line 14: /dev/tcp/mongo/27017: Invalid argument
/docker-entrypoint.sh: line 14: mongo: Try again
/docker-entrypoint.sh: line 14: /dev/tcp/mongo/27017: Invalid argument
/docker-entrypoint.sh: line 14: mongo: Try again
/docker-entrypoint.sh: line 14: /dev/tcp/mongo/27017: Invalid argument
/docker-entrypoint.sh: line 14: mongo: Try again
/docker-entrypoint.sh: line 14: /dev/tcp/mongo/27017: Invalid argument
/docker-entrypoint.sh: line 14: mongo: Try again
/docker-entrypoint.sh: line 14: /dev/tcp/mongo/27017: Invalid argument
[31mServer is open to allow connections from anyone (0.0.0.0)[39m

/node_modules/mongodb/lib/server.js:265
        process.nextTick(function() { throw err; })
                                      ^
MongoError: failed to connect to server [mongo:27017] on first connect
    at Pool.<anonymous> (/node_modules/mongodb-core/lib/topologies/server.js:326:35)
    at emitOne (events.js:116:13)
    at Pool.emit (events.js:211:7)
    at Connection.<anonymous> (/node_modules/mongodb-core/lib/connection/pool.js:270:12)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:126:13)
    at Connection.emit (events.js:214:7)
    at Socket.<anonymous> (/node_modules/mongodb-core/lib/connection/connection.js:175:49)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)

我做错了什么?

谢谢

1 个答案:

答案 0 :(得分:0)

如果您使用默认的mongo文档(例如Docker网站)进行此操作,

version: '3.1'

services:

  mongo:
    image: mongo
    restart: always
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: example

  mongo-express:
    image: mongo-express
    restart: always
    ports:
      - 8081:8081
    environment:
      ME_CONFIG_MONGODB_ADMINUSERNAME: root
      ME_CONFIG_MONGODB_ADMINPASSWORD: example

转到您的实例的IP地址/主机名(如http://10.10.10.3:8081或bananhammock.local:8081)很简单,它应该显示Express数据库屏幕。没有身份验证。确保端口号没有冲突。如果这不起作用,请发布您的docker-compose.yml文件和docker-compose日志输出