grunt serve in docker container max call stack error

Running grunt serve in a docker container causes node to crash (for lack of a better term).

(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.

 util.js:35
 var str = String(f).replace(formatRegExp, function(x) {
                  ^
 RangeError: Maximum call stack size exceeded

When I run the app * locally * it works as expected. This * only * happens when running it in the container. My guess is that it’s the live reload or one of the other port mappings causing the issue but I don’t know how to debug it. I expose the ports used by node in the dockerfile:

  • Docker missing layer IDs in output
  • Where are my files / Docker Django Digital Ocean
  • How do I connect to the localhost of a docker container (from inside the container)
  • boot2docker behind proxy - certificate signed by unknown authority
  • javaOptions with sbt docker:publishLocal and docker run
  • Docker Maven plugin: how to specify shm size when running a container
  •  EXPOSE 9000 9001 35729
    

    …grunt task…

     grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
    if (target === 'dist') {
      return grunt.task.run(['build', 'connect:dist:keepalive']);
    }
    
    grunt.task.run([
      'clean:server',
      'wiredep',
      'concurrent:server',
      'autoprefixer',
      'connect:livereload',
      'watch'
    ]);
     });
    
    
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/{,*/}*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      },
      server: '.tmp'
    },
    wiredep: {
      options: {
        cwd: '<%= yeoman.app %>'
      },
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath:  /\.\.\//
      }
    },
    concurrent: {
      server: [
        'copy:styles'
      ],
      test: [
        'copy:styles'
      ],
      dist: [
        'copy:styles',
        'imagemin',
        'svgmin'
      ]
    },
    autoprefixer: {
      options: {
        browsers: ['last 1 version']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      jsTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      styles: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.css'],
        tasks: ['newer:copy:styles', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },
    ....
    

    I’ve found related issues on stackoverflow but the solutions don’t seem to solve my issue.

    Thanks!

  • Docker failed to build on Openstack
  • ingensi/play-framework image repetitive downloads
  • Deploy a docker stack on one node (co-schedule containers like docker swarm)
  • How do I scale up my cluster on Google Container Engine / Kubernetes?
  • What is the simplest way to create an EC2 from a docker image hosted on ECR?
  • Placeholder field for the ONBUILD section for child docker images to use
  • One Solution collect form web for “grunt serve in docker container max call stack error”

    I encountered this error when my Gruntfile.js has the following code:

    grunt.registerTask('svgmin', ['svgmin']);
    

    I solve the problem by renaming the code to:

    grunt.registerTask('s', ['svgmin']);
    

    The problem of the code is that it created a new task called ‘svgmin’ to run ‘svgmin’ task which cause the infinite looping.

    Hope it helps.

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