Docker container crash while performing an "npm install" inside the container

I have setup a docker container using a debian:latest image and installed node v 5.10.1 and npm 3 in it. I then volume mount a web application with a standard sized package.json to this container using a docker-compose.yml to perform an “npm install” operation.

Docker version : Version 1.11.0-beta9 (build: 6388)
Mac OSX: 10.11.4

Expected behavior

I would expect the npm installation to complete normally, like it used to work in Docker Toolbox running on Virtual Box earlier.

Actual behavior

The container crashes and interrupts the npm installation about 80% through the process.

Information

  • the output of:
    • pinata diagnose -u on OSX
      OS X: version 10.11.4 (build: 15E65)
      Docker.app: version v1.11.0-beta9
      Running diagnostic tests:
      [OK] docker-cli
      [OK] Moby booted
      [OK] driver.amd64-linux
      [OK] vmnetd
      [OK] osxfs
      [OK] db
      [OK] slirp
      [OK] menubar
      [OK] environment
      [OK] Docker
      [OK] VT-x
      Docker logs are being collected into /tmp/20160429-043114.tar.gz
      Most specific failure is: No error was detected
      Your unique id is: 39173DA0-7E4C-42E9-9A3A-27553F2ACC63

Console log output

Exception in thread Thread-2:
Traceback (most recent call last):
  File "threading.py", line 810, in __bootstrap_inner
  File "threading.py", line 763, in run
  File "compose/cli/log_printer.py", line 149, in tail_container_logs
  File "compose/cli/log_printer.py", line 179, in wait_on_exit
  File "compose/container.py", line 239, in wait
  File "site-packages/docker/utils/decorators.py", line 21, in wrapped
  File "site-packages/docker/api/container.py", line 439, in wait
  File "site-packages/docker/client.py", line 154, in _raise_for_status
APIError: 500 Server Error: Internal Server Error ("dial unix /var/tmp/com.docker.vsock/00000003.00000948: connect: connection refused")
  • a reproducible case if this is a bug, Dockerfiles FTW
    1) The Dockerfile used to create the container is as follows.

    FROM debian:latest

    MAINTAINER Injoygiving

    All Enviornment Variables

    ENV DIR /App

    ENV NODE_VERSION 5.10.1

    WORKDIR $DIR

    RUN apt-get -y update && apt-get -y install
    wget
    git
    python
    vim

    NODE and NPM installation

    RUN wget https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz &&
    tar -zxf node-v$NODE_VERSION-linux-x64.tar.gz -C /usr/local &&
    ln -sf node-v$NODE_VERSION-linux-x64 /usr/local/node &&
    ln -sf /usr/local/node/bin/npm /usr/local/bin/ &&
    ln -sf /usr/local/node/bin/node /usr/local/bin/ &&
    rm node-v$NODE_VERSION-linux-x64.tar.gz &&
    npm install -g node-gyp &&
    npm install -g babel-cli

2) The Docker Compose.yml used to start up the the container with an “npm install”

version: '2'
services:
  webserver:
      image: webserver:1.0
      volumes:
        - ${PWD}:/App
      ports:
        - "3000:3000"
        - "3001:3001"
        - "3002:3002"
      command: npm install

3) Package.json file used for npm installs

{
  "private": true,
  "engines": {
    "node": ">=5.0 <6",
    "npm": ">=3.3 <4"
  },
  "dependencies": {
    "babel-polyfill": "6.7.4",
    "babel-runtime": "6.6.1",
    "bluebird": "3.3.5",
    "body-parser": "1.15.0",
    "classnames": "2.2.3",
    "cookie-parser": "1.4.1",
    "core-js": "2.2.2",
    "eventemitter3": "1.2.0",
    "express": "4.13.4",
    "express-graphql": "0.5.1",
    "express-jwt": "3.3.0",
    "fastclick": "1.0.6",
    "fbjs": "0.8.1",
    "front-matter": "2.0.7",
    "graphiql": "0.7.0",
    "graphql": "0.5.0",
    "history": "2.1.0",
    "isomorphic-style-loader": "1.0.0",
    "jade": "1.11.0",
    "jsonwebtoken": "5.7.0",
    "markdown-it": "6.0.1",
    "node-fetch": "1.5.1",
    "normalize.css": "4.1.1",
    "passport": "0.3.2",
    "passport-facebook": "2.1.0",
    "pretty-error": "2.0.0",
    "react": "15.0.1",
    "react-dom": "15.0.1",
    "sequelize": "^3.21.0",
    "source-map-support": "0.4.0",
    "sqlite3": "^3.1.3",
    "universal-router": "1.1.0-beta.3",
    "whatwg-fetch": "0.11.0"
  },
  "devDependencies": {
    "assets-webpack-plugin": "^3.4.0",
    "autoprefixer": "^6.3.6",
    "babel-cli": "^6.7.7",
    "babel-core": "^6.7.7",
    "babel-eslint": "^6.0.3",
    "babel-loader": "^6.2.4",
    "babel-plugin-react-transform": "^2.0.2",
    "babel-plugin-rewire": "^1.0.0-rc-2",
    "babel-plugin-transform-react-constant-elements": "^6.5.0",
    "babel-plugin-transform-react-inline-elements": "^6.6.5",
    "babel-plugin-transform-react-remove-prop-types": "^0.2.5",
    "babel-plugin-transform-runtime": "^6.7.5",
    "babel-preset-es2015": "^6.6.0",
    "babel-preset-node5": "^11.0.1",
    "babel-preset-react": "^6.5.0",
    "babel-preset-stage-0": "^6.5.0",
    "babel-register": "^6.7.2",
    "babel-template": "^6.7.0",
    "babel-types": "^6.7.7",
    "browser-sync": "^2.12.3",
    "chai": "^3.5.0",
    "css-loader": "^0.23.1",
    "del": "^2.2.0",
    "enzyme": "^2.2.0",
    "eslint": "^2.8.0",
    "eslint-config-airbnb": "^7.0.0",
    "eslint-loader": "^1.3.0",
    "eslint-plugin-jsx-a11y": "^0.6.2",
    "eslint-plugin-react": "^4.3.0",
    "extend": "^3.0.0",
    "file-loader": "^0.8.5",
    "gaze": "^1.0.0",
    "git-repository": "^0.1.4",
    "glob": "^7.0.3",
    "jade-loader": "^0.8.0",
    "jscs": "^2.11.0",
    "json-loader": "^0.5.4",
    "mkdirp": "^0.5.1",
    "mocha": "^2.4.5",
    "ncp": "^2.0.0",
    "postcss": "^5.0.19",
    "postcss-import": "^8.1.0",
    "postcss-loader": "^0.8.2",
    "postcss-scss": "^0.1.7",
    "node-sass": "latest",
    "sass-loader": "latest",
    "susy": "^2.2.2",
    "breakpoint-sass": "latest",
    "precss": "^1.4.0",
    "raw-loader": "^0.5.1",
    "react-addons-test-utils": "^15.0.1",
    "react-transform-catch-errors": "^1.0.2",
    "react-transform-hmr": "^1.0.4",
    "redbox-react": "^1.2.3",
    "sinon": "^2.0.0-pre",
    "stylelint": "^6.0.3",
    "stylelint-config-standard": "^6.0.0",
    "url-loader": "^0.5.7",
    "webpack": "^1.13.0",
    "webpack-hot-middleware": "^2.10.0",
    "webpack-middleware": "^1.5.1"
  },
  "babel": {
    "presets": [
      "react",
      "node5",
      "stage-0"
    ],
    "env": {
      "test": {
        "plugins": [
          "rewire"
        ]
      }
    }
  },
  "eslintConfig": {
    "parser": "babel-eslint",
    "extends": "airbnb",
    "globals": {
      "__DEV__": true
    },
    "env": {
      "browser": true
    },
    "rules": {
      "no-confusing-arrow": 0,
      "react/jsx-quotes": 0,
      "jsx-quotes": [
        2,
        "prefer-double"
      ]
    }
  },
  "jscsConfig": {
    "preset": "airbnb",
    "excludeFiles": [
      "build/**",
      "node_modules/**"
    ],
    "disallowSpacesInsideTemplateStringPlaceholders": null
  },
  "stylelint": {
    "extends": "stylelint-config-standard",
    "rules": {
      "string-quotes": "single"
    }
  },
  "scripts": {
    "eslint": "eslint src tools",
    "jscs": "jscs src tools --verbose",
    "stylelint": "stylelint \"src/**/*.scss\" --syntax scss",
    "lint": "npm run eslint && npm run jscs && npm run stylelint",
    "test": "mocha src/**/*.test.js --require test/setup.js --compilers js:babel-register",
    "test:watch": "mocha src/**/*.test.js --require test/setup.js --compilers js:babel-register --reporter min --watch",
    "clean": "babel-node tools/run clean",
    "copy": "babel-node tools/run copy",
    "bundle": "babel-node tools/run bundle",
    "build": "babel-node tools/run build --release",
    "deploy": "babel-node tools/run deploy",
    "start": "babel-node tools/run start",
    "release": "babel-node tools/run start --release"
  }
}
  • page URL if this is a docs issue or the name of a man page
  • host distribution and version ( OSX 10.10.x, OSX 10.11.x, Windows, etc )
    OSX 10.11.4 using Docker for Mac Beta 9

Steps to reproduce the behavior

  1. Create the docker image (webserver:1.0) using docker build -t webserver:1.0 . (using the docker file code provided above)
  2. Create the package.json file supplied above.
  3. Start up a container using docker-compose up (using the docker-compose.yml provided above)

I got this to work however had to try multiple times. I guess by performing npm installs in parts it completed fine. However trying to install it in a single go almost never works. Is this a case of crashing the container when a large number of write operations happen inside the container ?

We’ve found an issue with heavy load on the hypervisor transport that can cause the hypervisor to crash. This issue should be resolved in Beta 10.

Thanks for your participation in the Docker for Mac Beta!

1 Like

This is then a task for the Unikernel Systems team :smiley:

I am seeing the same issue in 1.11.1-beta10 (build 5604cbe).

Our use case is a bunch on linked containers (8), RabbitMQ, Memcached, Elasticsearch, Losgstash, Postgres and a few custom containers. We then run a test suite against it. Most of the time it crashes halfway through. Sometimes after just restarting docker with extra memory it will complete. When it crashes I get the same exception as OP but in multiple threads at the same time. Let me know if you need extra information.

In beta 10, the npm installs go fine for me without any crashes.

Hi Simon, What exactly does the test suite you run against your different containers do ? That might shed some light to the problem.

The test suite has a handful of scenarios (15). Each one starts off by deleting all indexes in Elasticsearch, clearing queues in RabbitMQ, clearing Memcached and reseting a Postgres database. It then loads a bunch of data into Elasticsearch through Logstash. It then opens up a browser and navigates our web app. The app and celery are running outside Docker for now. So from the docker containers perspective it gets a bunch of Elasticsearch and Postgres queries and to a lesser extent items added to RabbitMQ and Memcached.

This morning I upgraded to 1.11.1-beta11 (build: 6974) and ran the test suite three times in succession. Docker still up and running. :slight_smile: I run this multiple times daily so I it happens again I will report here.

Thanks
Simon

1 Like