Tag: mongodb

Seeding data in a Mongo db within a linked Docker container

I’m using fig to deploy my Node.js app. fig.yml web: build: . command: node app.js links: – db ports: – “1337:1337” db: image: dockerfile/mongodb Running fig run db env gives me the following environment vars: DB_PORT=tcp:// DB_PORT_27017_TCP=tcp:// DB_PORT_27017_TCP_ADDR= DB_PORT_27017_TCP_PORT=27017 DB_PORT_27017_TCP_PROTO=tcp DB_PORT_28017_TCP=tcp:// DB_PORT_28017_TCP_ADDR= DB_PORT_28017_TCP_PORT=28017 DB_PORT_28017_TCP_PROTO=tcp DB_NAME=/pos_db_run_3/db My app’s Dockerfile looks like this # Pull base image. […]

Connect to meteor mongo from local docker image on Mac

meteor mongo -U shows me mongodb:// as the connection string. I understand that the docker image will try to connect to itself and fail. I tried substituting for any IP address I could find when running ifconfig with the same result: { [MongoError: connect ECONNREFUSED xxx.xxx.xxx.xxx:3001] name: ‘MongoError’, message: ‘connect ECONNREFUSED xxx.xxx.xxx.xxx:3001’ } Not […]

NodeJS Mongodb in docker compose = ECONNREFUSED

I try to up a Node.JS container linked with a MongoDB container by docker-compose, but systematically node.js return an ECONNREFUSED error. The error nodejs_1 | /code/node_modules/mongoose/node_modules/mongodb/lib/server.js:228 nodejs_1 | process.nextTick(function() { throw err; }) nodejs_1 | nodejs_1 | Error: connect ECONNREFUSED nodejs_1 | at exports._errnoException (util.js:746:11) nodejs_1 | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19) NodeJS code var […]

connecting to local mongodb from docker container

I have a local mongoDB server running on mongodb:// My DB name is localv2. I have a node/express app with the Dockerfile as follows: FROM node:7.5 RUN npm install -g pm2 RUN mkdir -p /usr/src/app WORKDIR /usr/src/app COPY package.json /usr/src/app RUN npm install COPY . /usr/src/app EXPOSE 3002 ENV NODE_ENV local CMD pm2 start –no-daemon […]

Using Docker to build an image for Node, my Express based Node app, MongoDb, and NodeBB, connected via Passport

I’ve just been introduced to Docker and the concept is awesome. I’ve found simple Dockerfiles for building an image for MongoDB and Node and was wondering, do I just combine those images together to make one image that has my project which is a combination of a custom Node app (built on Express), a NodeBB […]

Mongo replica node with docker

I have setup a Mongo Primary node with docker using docker image https://hub.docker.com/_/mongo/. Now I wish to add replica node in my current setup using docker only. Can anybody help me with this?

How to acces mongorestore/mongodump in docker image

I’m trying to access mongorestore/mongodump commands from within a docker image that’s been run via gitlab-ci-multirunner. My .gitlab-ci.yml looks something like this: image: node:7.2.0 cache: key: “$CI_BUILD_REF_NAME” paths: – node_modules/ services: – mongo variables: DOCKER_ENV: ‘true’ NODE_ENV: ‘test’ all_tests: script: – npm install – npm install tsd -g – tsd install –save – node_modules/typescript/bin/tsc -p […]

Docker rails mongodb NoServerAvailable

I am building a project with 3 docker. API with Rails Website angular / webpack DB with mongodb So i have a docker-compose to handle everything. My problem is when i want to seed my database, i have an error : Mongo::Error::NoServerAvailable: No server is available matching preference: #<Mongo::ServerSelector::Primary:0x47121755943460 tag_sets=[] server_selection_timeout=30 local_threshold=0.015> I tried many […]

Mongorestore in a Dockerfile

I want to create a Docker image that starts a mongo server and automatically restores from a previous mongodump on startup. Here is my Dockerfile for the image: FROM mongo COPY dump /home/dump CMD mongorestore /home/dump When I run this, I run into this error: Failed: error connecting to db server: no reachable servers Is […]

Node / Express app can't connect to docker mongodb

I want to run a node app that uses express and connects to a (boot2docker) docker mongo container. When I first wrote the app, I was using a locally installed instance of mongodb, and the following config worked: module.exports = { env: ‘development’, mongo: { uri: ‘mongodb://localhost/fullstack-dev’ } }; And it ran as expected. Now […]

Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.