Javascript Gulp Build Errors: [Error: EBADF: bad file descriptor, read]

Expected behavior

Running my docker containers would result in javascript files being built via gulp.

Actual behavior

I am getting many errors like this:

opentest_1 | [02:00:21] { [Error: EBADF: bad file descriptor, read]
opentest_1 |   errno: -9,
opentest_1 |   code: 'EBADF',
opentest_1 |   syscall: 'read',
opentest_1 |   stream:
opentest_1 |    Labeled {
opentest_1 |      _readableState:
opentest_1 |       ReadableState {
opentest_1 |         highWaterMark: 16,
opentest_1 |         buffer: [],
opentest_1 |         length: 0,
opentest_1 |         pipes: [Object],
opentest_1 |         pipesCount: 1,
opentest_1 |         flowing: true,
opentest_1 |         ended: false,
opentest_1 |         endEmitted: false,
opentest_1 |         reading: true,
opentest_1 |         sync: false,
opentest_1 |         needReadable: true,
opentest_1 |         emittedReadable: false,
opentest_1 |         readableListening: false,
opentest_1 |         objectMode: true,
opentest_1 |         defaultEncoding: 'utf8',
opentest_1 |         ranOut: false,
opentest_1 |         awaitDrain: 0,
opentest_1 |         readingMore: false,
opentest_1 |         decoder: null,
opentest_1 |         encoding: null,
opentest_1 |         resumeScheduled: false },
opentest_1 |      readable: true,
opentest_1 |      domain: null,
opentest_1 |      _events:
opentest_1 |       { end: [Object],
opentest_1 |         error: [Object],
opentest_1 |         data: [Function: ondata],
opentest_1 |         _mutate: [Object] },
opentest_1 |      _eventsCount: 4,
opentest_1 |      _maxListeners: undefined,
opentest_1 |      _writableState:
opentest_1 |       WritableState {
opentest_1 |         highWaterMark: 16,
opentest_1 |         objectMode: true,
opentest_1 |         needDrain: false,
opentest_1 |         ending: true,
opentest_1 |         ended: true,
opentest_1 |         finished: true,
opentest_1 |         decodeStrings: true,
opentest_1 |         defaultEncoding: 'utf8',
opentest_1 |         length: 0,
opentest_1 |         writing: false,
opentest_1 |         corked: 0,
opentest_1 |         sync: false,
opentest_1 |         bufferProcessing: false,
opentest_1 |         onwrite: [Function],
opentest_1 |         writecb: null,
opentest_1 |         writelen: 0,
opentest_1 |         buffer: [],
opentest_1 |         pendingcb: 0,
opentest_1 |         prefinished: true,
opentest_1 |         errorEmitted: false },
opentest_1 |      writable: true,
opentest_1 |      allowHalfOpen: true,
opentest_1 |      _options: { objectMode: true },
opentest_1 |      _wrapOptions: { objectMode: true },
opentest_1 |      _streams: [ [Object] ],
opentest_1 |      length: 1,
opentest_1 |      label: 'deps' } }

Information

vinay@Vinays-MacBook-Pro ~> pinata diagnose -u
OS X: version 10.11.4 (build: 15E65)
Docker.app: version v1.11.1-beta13
Running diagnostic tests:
[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/20160525-190151.tar.gz
Most specific failure is: No error was detected
Your unique id is: DB968B29-02F7-450B-8B19-62201F32676A
Please quote this in all correspondence.

Steps to reproduce the behavior

  1. Create a Docker container with npm/node off of Ubuntu 14.04 (http://cl.ly/3v0A2V2I0V2a)
  2. Run a repo with gulp and compile javascript via the browserify module.

I noticed that I wasn’t asked for sudo permissions during this update, so I will try to reinstall Docker to see if that fixes things.

I found this post when googling and confirm that I saw the same error on our stack:

  • ubuntu 14.04
  • node 6.x

We are not using Gulp. Pinata output is [OK].
Updated to latest beta ( Version 1.11.1-beta13 (build: 7975) ).

Restarting my system and building with --no-cache seems to have fixed the problem.

Could you please post a minimal reproduction of this issue? A shell script, Dockerfile, Makefile, or similar or a git repository that exhibits the issue would be very helpful.

For us it was related to the use of Nodemon.
The issue was we where running too many process per container.
A docker best practice is: ‘run one container per process’.

In almost all cases, you should only run a single process in a single container. Decoupling applications into multiple containers makes it much easier to scale horizontally and reuse containers. If that service depends on another service, make use of container linking.

Yep I’m also running Nodemon, but it was working before pre-beta13. This actually seems like it may have to do with volume mounts: