Mattia Di Giuseppe
Mattia Di Giuseppe

Reputation: 55

Mongo Express Docker

I have setup my mongodb docker image on my plesk server with ubuntu 14.04 LTS. All is ok about mongo. I can access from shell and from robot 3t. I need to use mongo express to manage mongo db from web based interface.

enter image description here I have set the variabile as in picture but i have these problems in the log and i can't access to web interface.

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)

What i'm doing wrong?

Thanks

Upvotes: 3

Views: 3584

Answers (1)

G_L
G_L

Reputation: 103

If you did this with the default mongo documentation such as on the Docker website:

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

It should be a simple matter of going to the ip/hostname of your instance like http://10.10.10.3:8081 or bananhammock.local:8081 and it should show you the Express database screen. There is no authentication. Make sure the port number doesn't conflict. If this doesn't work, post your docker-compose.yml file and docker-compose logs output

Upvotes: 3

Related Questions