Docker Ember crashing

I am trying for local development to use ember in a container. The problem is that I will go and save a file and ember in the container crashes. Its just so frustrating and not sure if this is an ember or a docker issue. Here is what is in the log file

ERROR Summary:

  - broccoliBuilderErrorStack: Error: ENOENT: no such file or directory, scandir '/myapp/tmp/config_loader-input_base_path-bwCbaFQr.tmp/'
    at Object.fs.readdirSync (fs.js:904:18)
    at _walkSync (/myapp/node_modules/walk-sync/index.js:74:18)
    at Function.entries (/myapp/node_modules/walk-sync/index.js:50:10)
    at ConfigLoader.CachingWriter._conditionalBuild (/myapp/node_modules/broccoli-caching-writer/index.js:112:24)
    at /myapp/node_modules/broccoli-plugin/read_compat.js:93:34
    at tryCatch (/myapp/node_modules/rsvp/dist/rsvp.js:525:12)
    at invokeCallback (/myapp/node_modules/rsvp/dist/rsvp.js:538:13)
    at publish (/myapp/node_modules/rsvp/dist/rsvp.js:508:7)
    at flush (/myapp/node_modules/rsvp/dist/rsvp.js:2415:5)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

  - codeFrame: ENOENT: no such file or directory, scandir '/myapp/tmp/config_loader-input_base_path-bwCbaFQr.tmp/'
  - errorMessage: Build Canceled: Broccoli Builder ran into an error with `ConfigLoader` plugin. 💥
ENOENT: no such file or directory, scandir '/myapp/tmp/config_loader-input_base_path-bwCbaFQr.tmp/'
  - errorType: Build Error
  - location:
    - column: [undefined]
    - file: [undefined]
    - line: [undefined]
    - treeDir: [undefined]
  - message: Build Canceled: Broccoli Builder ran into an error with `ConfigLoader` plugin. 💥
ENOENT: no such file or directory, scandir '/myapp/tmp/config_loader-input_base_path-bwCbaFQr.tmp/'
  - name: Error
  - nodeAnnotation: ConfigLoader
  - nodeName: ConfigLoader
  - originalErrorMessage: ENOENT: no such file or directory, scandir '/myapp/tmp/config_loader-input_base_path-bwCbaFQr.tmp/'
  - stack: Error: ENOENT: no such file or directory, scandir '/myapp/tmp/config_loader-input_base_path-bwCbaFQr.tmp/'
    at Object.fs.readdirSync (fs.js:904:18)
    at _walkSync (/myapp/node_modules/walk-sync/index.js:74:18)
    at Function.entries (/myapp/node_modules/walk-sync/index.js:50:10)
    at ConfigLoader.CachingWriter._conditionalBuild (/myapp/node_modules/broccoli-caching-writer/index.js:112:24)
    at /myapp/node_modules/broccoli-plugin/read_compat.js:93:34
    at tryCatch (/myapp/node_modules/rsvp/dist/rsvp.js:525:12)
    at invokeCallback (/myapp/node_modules/rsvp/dist/rsvp.js:538:13)
    at publish (/myapp/node_modules/rsvp/dist/rsvp.js:508:7)
    at flush (/myapp/node_modules/rsvp/dist/rsvp.js:2415:5)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

Here is my docker-compose file

version: '3'

volumes:
  ember-tmp:
  ember-bower_components:
  ember-node_modules:

services:
  ember:
    # image: danlynn/ember-cli:2.18.2
    build: .
    container_name: cf2-ember
    ports:
      - 7357:7357
      - 4200:4200
      - 9222:9222
      - 49152:49152
    volumes:
      - .:/myapp
      - ember-tmp:/myapp/tmp
      - ./dist:/myapp/dist
      - ember-bower_components:/myapp/bower_components
      - ember-node_modules:/myapp/node_modules
      - ./docker/entrypoint-ember.sh:/entrypoint-ember.sh
    command: ["sh", "/entrypoint-ember.sh"]

Any help would be appreciated

Hello :wave:!

I have been using Docker with Ember for a long time now and it works great for the most part.

The thing that might be causing problems with your setup is that you are sharing the tmp folder using volumes.

I would remove bower_components, node_modules and tmp folders from the volumes section of your docker-compose.yml.

One of the reason why you wouldn’t want to share node_modules for example, is that it might be using native extensions. These native extensions usually needs to be build on the platform that will be running on. One project that has native extensions is node-sass which is a dependency of ember-cli-sass.

I hope this might help you.

You will notice that in - /myapp/bower_components that its not following the convention of x:x. This is a way in docker-compose to exclude it. I guess maybe I do not need that since I added those directories to the dockerignore?

Here is my dockerignore file

bower_components
node_modules
tmp
.git

are you using Docker with Ember for local development? do you find it slower at all? do you have a copy of your Dockerfile?

Sure you can see my dockerfile

FROM node:8.11.1-alpine
LABEL maintainer="John"

ENV EMBER_VERSION=2.18.2 APP_DIR=/myapp

RUN apk add --no-cache \
  git && \
  yarn global add ember-cli@$EMBER_VERSION bower@latest && \
  mkdir -p $APP_DIR && \
  cd $APP_DIR

COPY ./docker/entrypoint-ember.sh /entrypoint.sh

EXPOSE 4200 7357 8080 9222 7020
WORKDIR $APP_DIR
VOLUME [$APP_DIR]

CMD ["/entrypoint.sh"]

I will also update my docker-compose file in OP as well as I made some tweaks

@josemarluedke @jrock2004 do either of you find live reload slow through a container?

I did until I realized that docker was keeping the node_modules, tmp, and bower_components in sync between host and container. After disabling that, things will speed up alot. I have noticed if you have a big project it can get slow as well

I feel that is a little slower than when outside of Docker. However, it can depend how are you using Docker, eg. Docker for mac, filesystem etc.

I have been using Ember with docker for a long time now, for sure I had moment that I wanted to stop using Docker, mainly it was before Docker for Mac and the nice filesystem integration. Now days it works very well, however, if you have a bunch of projects running in docker and not much memory, the Ember build can get very slow as well.

What have been your experience with it?

Would you guys mind sharing your Dockerfile and docker-compose.yml files? Did you try using Docker Hub ?

I at you in slack channel with the info

1 Like

In my experience I was doing a fair bit of development on a Windows 10 machine (Surface Book 2 with great specs) and npm install and live reload and ember build are all very very slow. When I use docker for local ember-cli development it actually becomes much faster. I believe this is because the filesystem read/write is slow in Windows and fast in Linux.

my docker-compse.yml

# docker-compose run --rm ember npm install
# docker-compose up

version: "3"

services:
  ember:
    command: "ember server --watcher polling"
    container_name: quovo-commander
    image: aliencyborg/ember-cli:3.1.0-beta.1
    ports:
      - "4200:4200"
      - "7020:7020"
      - "7357:7357"
    volumes:
      - .:/app
      - tmp:/app/tmp
      - nodemod:/app/node_modules

volumes:
  nodemod:
  tmp:

You must first run

docker-compose run --rm ember npm install

source for dockerfiles Docker Hub

Here is my Dockerfile and docker-compose.yml. Note that for the docker compose file, I leave it in a parent directory and I’m using version 2.

@jrock2004 just curious if you were able to find a solution to this issue? I’m seeing the same thing. Thanks!

Just had to leave vim for my big projects