Tag: node.js

how can i dynamically create a docker container from a node application

How can i dynamically create a docker container from a node application.? I tried executing docker commands using exec and spawn with root privilege but it is not working. Can anyone help me find out what is the problem with my code? exec(‘docker run -it ubuntu14 >> log.log ‘, function callback(error, stdout, stderr) { console.log(stdout); […]

Connection slow from node to mongodb

I’m experimenting with docker and reflected a very slow connection from the nodejs (4.2.3) container to mongodb (3.2) container. My setup, very basic, is this (docker-compose): version: ‘2’ services: web: build: ./app volumes: – “./app:/src/app” ports: – “80:3000” links: – “db_cache:redis” – “db:mongodb” command: nodemon -L app/bin/www db_cache: image: redis db: image: mongo My s.o. […]

Docker and Angular app: one or two containers?

I have difficulties to understand the whole proces of an Angular-app in Docker. So anguler needs a webserver to run (like nginx) but also needs nodejs to access the backend? Do you have divide this in 2 containers or how do you have to perform this? I have now 1 container which had as base […]

RestAPI and Front-End on the same port in Docker

I have created new droplet on DigitalOcean and installed Docker. I have two containers, one with my NodeJS app = RestAPI on port 8080, and second with Nginx that basically expose my static html files (with AngularJS) on port 80. But now, I want to start making requests from my Front-End AngularJS app to the […]

fs.readFile Behaving Differently Inside Docker Container

The following code has never failed when run in dev on OSX, but fails every time in a production environment which lives in a Docker container: DataSyncController.js let jsonFile = await FileSystemService.ParseCsvToJson(fileName); if (!jsonFile.success) return res.json({ success: false }); let parsedJson = await FileSystemService.ParseJsonFile({ file: jsonFile.fileName }); if (!parsedJson.success) return res.json({ success: false }); FileSystemService.js […]

npm ERR! Linux 4.1.19-boot2docker

I am trying to install some package, however, I don’t know why I get such errors in the container: npm ERR! Linux 4.1.19-boot2docker npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “install” npm ERR! node v5.10.1 npm ERR! npm v3.8.3 npm ERR! path ../mime/cli.js npm ERR! code EPROTO npm ERR! errno -71 npm ERR! syscall symlink npm ERR! […]

Cannot find module 'express'

I’m using docker-compose to run node.js express app. this is my Dockerfile FROM node:latest MAINTAINER jorge@valeet.io # set default workdir WORKDIR /src/api # Expose the application port and run application EXPOSE 3015 CMD [ “node” , “app.js”] docker-compose.yml api: build: . volumes: – .:/src/api – /src/api/node_modules links: – mongo ports: – “3015:3015” mongo: image: mongo:3.2 […]

Is there a docker compose service naming convention?

I have an question about the service names in docker-compose.yml files. Is there any convention for the naming? I have following example (docker-compose.yml): This example does not work when I run docker-compose. The log files tell me, that my node app could not find the express module: nodejs: build: ./docker_node_js volumes: – “./docker_node_js/app:/src/app” ports: – […]

Mongodb collection insert ignoring unique index

I have the following Image Model, built w/ mongoose, using two unique indexes: ‘use strict’; var mongoose = require(‘bluebird’).promisifyAll(require(‘mongoose’)); var Schema = new mongoose.Schema({ name: String, src: { type:String, unique: true }, height: String, width: String, importSrc: { type:String, unique: true }, status: String, // Timestamps createdAt: Date, updatedAt: Date, deletedAt: Date }); Schema.pre(‘save’, function(next){ […]

How to run local server in host?

I’ve just installed nodejs using docker, and I run a test server: docker exec -i -t my-running-app bash root@46593eb5df5c:/usr/src/app# npm start npm info it worked if it ends with ok npm info using npm@2.15.1 npm info using node@v4.4.3 npm info prestart foo@ npm info start foo@ > foo@ start /usr/src/app > node server.js Server running […]

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