Docker Community Forums

Share and learn in the Docker community.

MeteorJS build, Error: failed to connect to [127.0.0.1:3001]

build
docker

(Scheung) #1

This is my DockerFile:

ENV MONGO_URL="mongodb://127.0.0.1:3001/meteor"

ENV MONGO_OPLOG_URL="mongodb://oplogger:oplogger@127.0.0.1:27017/local?authSource=admin"

tupperware.json:

{
  "dependencies": {
    "phantomJs": false,
    "imageMagick": false
  },
"preBuildCommands": ["sudo apt-get update && sudo apt-get install -y build-essential python"],
  "postBuildCommands": [],
  "buildOptions": {
    "mobileServerUrl": false,
    "additionalFlags": false
  }
}

$ docker build -t scheung/spark2acs .

Successfully built f5ea5b22f5a7

But trying to run it

$ docker run --rm  -p 8080:80 scheung/spark2acs

Error: failed to connect to [127.0.0.1:3001]
    at Object.Future.wait (/output/bundle/programs/server/node_modules/fibers/future.js:420:15)
    at new MongoConnection (packages/mongo/mongo_driver.js:213:27)
    at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:16)
    at Object.<anonymous> (packages/mongo/remote_collection_driver.js:38:10)
    at Object.defaultRemoteCollectionDriver (packages/underscore/underscore.js:750:1)
    at new Mongo.Collection (packages/mongo/collection.js:102:40)
    at AccountsServer.AccountsCommon (packages/accounts-base/accounts_common.js:23:18)
    at new AccountsServer (packages/accounts-base/accounts_server.js:18:5)
    at meteorInstall.node_modules.meteor.accounts-base.server_main.js (packages/accounts-base/server_main.js:9:12)
    at fileEvaluate (packages/modules-runtime/.npm/package/node_modules/install/install.js:141:1)
    - - - - -
    at [object Object].<anonymous> (/output/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/mongodb/connection/server.js:556:25)
    at emitThree (events.js:97:13)
    at [object Object].emit (events.js:175:7)
    at [object Object].<anonymous> (/output/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:156:15)
    at emitTwo (events.js:87:13)
    at [object Object].emit (events.js:172:7)
    at Socket.<anonymous> (/output/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/mongodb/connection/connection.js:534:10)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at emitErrorNT (net.js:1269:8)

Do I need to use iptables to ACCEPT Port 22? If so please let me know how to set rules.


(Nathan Le Claire) #2

If you want to connect to MongoDB from a Meteor app running in a container you probably do not want to connect to localhost. You want to run the MongoDB in a container on the same docker network, and then use DNS entry corresponding to container name, e.g. mongo command would look like docker run -d --name mongo --net meteorapp mongodb, and you would connect to mongo:30001 in the Meteor container, also invoked with --net meteorapp.


(Niceseb) #3

So I need to change the definitions within the DockerFile and rebuild? Or just run with different options using the existing definitions?


(Scheung) #4

Hi Nathan,

Could you show with actual example? Cheers