Meteor run with remote mongodb (docker)?


I would like to local meteor run with remote mongodb

// Local
MONGO_URL='mongodb://root:pwd@' meteor

Get error

MongoError: failed to connect to server [] on first connect
W20180914-16:57:33.999(7)? (STDERR)     at Object.Future.wait (/Users/theara/.meteor/packages/meteor-tool/.1.4.2_2.lqfb7c.mi0hm++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:449:15)
W20180914-16:57:33.999(7)? (STDERR)     at new MongoConnection (packages/mongo/mongo_driver.js:219:27)
W20180914-16:57:34.000(7)? (STDERR)     at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:16)
W20180914-16:57:34.000(7)? (STDERR)     at Object.<anonymous> (packages/mongo/remote_collection_driver.js:38:10)
W20180914-16:57:34.000(7)? (STDERR)     at Object.defaultRemoteCollectionDriver (packages/underscore.js:784:19)
W20180914-16:57:34.000(7)? (STDERR)     at new Mongo.Collection (packages/mongo/collection.js:103:40)
W20180914-16:57:34.001(7)? (STDERR)     at AccountsServer.AccountsCommon (packages/accounts-base/accounts_common.js:23:18)
W20180914-16:57:34.001(7)? (STDERR)     at new AccountsServer (packages/accounts-base/accounts_server.js:18:5)
W20180914-16:57:34.002(7)? (STDERR)     at meteorInstall.node_modules.meteor.accounts-base.server_main.js (packages/accounts-base/server_main.js:9:12)
W20180914-16:57:34.006(7)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:181:9)
W20180914-16:57:34.007(7)? (STDERR)     - - - - -
W20180914-16:57:34.007(7)? (STDERR)     at [object Object].<anonymous> (/Users/theara/.meteor/packages/npm-mongo/.2.2.11_2.1b3rrht++os+web.browser+web.cordova/npm/node_modules/mongodb-core/lib/topologies/server.js:313:35)

(I can access mongo server via Mongo IDE)


I tried the same thing without success. I remember that was an specific bug on that docker version that prevented the ENV being set like this.

To solve that I created a docker-compose.yaml, that handles the connection.

  1. Make sure you have a working meteor-docker-dev dockerfile on the app root.
  2. docker-compose up
version: "3"
    container_name: meteor
    restart: always
        - .:/home/meteor/app/
    build: .
      - "3000:3000"
      - mongo
    container_name: mongo
    image: mongo
      - ../mongoDB/rally:/data/db
      - "27017:27017"


This may be due to the remote mongo server not being configured to allow access over the network. You would need to edit the mongo conf files/startup command to enable this. I think it may be off by default and only work on localhost.

If the server can be accessed over the network (e.g. from robomongo) then it may be to do with user authorisation.

MongoUrl is the db username and password (not the ssh passwords - root is suggesting you are maybe using this). The mongo server needs to have a user created with appropriate permissions to access the ‘meteordb’ database.

As an admin in the remote mongo shell:
db.createUser({ user:"mongouser", pwd:"desiredpassword", roles:[{role:"readWrite",db:"databasename"}] })


@pmcochrane, thanks for your reply.
I tried to create user on mongodb.
And then run meteor

// Local
MONGO_URL='mongodb://testing:pwd123456@' meteor

Get error

W20180916-08:58:40.274(7)? (STDERR) 						throw(ex);
W20180916-08:58:40.274(7)? (STDERR) 						^
W20180916-08:58:40.275(7)? (STDERR) Error: read ECONNRESET
W20180916-08:58:40.275(7)? (STDERR)     at Object.Future.wait (/Users/theara/.meteor/packages/meteor-tool/.1.4.2_2.lqfb7c.mi0hm++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:449:15)
W20180916-08:58:40.276(7)? (STDERR)     at new MongoConnection (packages/mongo/mongo_driver.js:219:27)
W20180916-08:58:40.276(7)? (STDERR)     at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:16)
W20180916-08:58:40.277(7)? (STDERR)     at Object.<anonymous> (packages/mongo/remote_collection_driver.js:38:10)
W20180916-08:58:40.278(7)? (STDERR)     at Object.defaultRemoteCollectionDriver (packages/underscore.js:784:19)
W20180916-08:58:40.278(7)? (STDERR)     at new Mongo.Collection (packages/mongo/collection.js:103:40)
W20180916-08:58:40.279(7)? (STDERR)     at AccountsServer.AccountsCommon (packages/accounts-base/accounts_common.js:23:18)
W20180916-08:58:40.280(7)? (STDERR)     at new AccountsServer (packages/accounts-base/accounts_server.js:18:5)
W20180916-08:58:40.281(7)? (STDERR)     at meteorInstall.node_modules.meteor.accounts-base.server_main.js (packages/accounts-base/server_main.js:9:12)
W20180916-08:58:40.281(7)? (STDERR)     at fileEvaluate (packages/modules-runtime.js:181:9)
W20180916-08:58:40.282(7)? (STDERR)     - - - - -
W20180916-08:58:40.285(7)? (STDERR)     at exports._errnoException (util.js:911:11)
W20180916-08:58:40.287(7)? (STDERR)     at TCP.onread (net.js:558:26)
=> Exited with code: 1

Please help me


Oh I connect (Mongo Booster) with SSH.
How to solve?


If you look at the /etc/mongod.conf file on the mongo container then there should be an option for bindIp. This is probably set to localhost ( You would need to make this accessible over the network by setting the bindIP address to an actual network address.

I don’t use mongo in docker so do not know what you need to configure this for use in a docker container. It entirely depends upon how you are trying to setup docker. Docker gives many ways to configure containers (manual, compose files, swarm services) all of which are not configured in the same way.


You may also need to add an authSource=admin or an authSource=databasename in your mongo_url depending upon which database you setup the user privilieges.


thanks, you are right.
I found this