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:

  • How get the number of pulls of a docker tag?
  • Kinesis agent install in docker fails on missing mirrors
  • Are Docker links deprecated?
  • How to deploy Spark,That it can make the highest resource utilization
  • How to install telnet in Docker for Windows 10
  • Binaries from postgresql not available when linked to another docker 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 containers in different directories under one daemon
  • Different env-file but same yml with Docker Compose?
  • Vmstateevent invalid json error installing docker on mac Sierra
  • Docker Tomcat exited 0 after run
  • How to migrate existing tomcat application with Orcale database connection to Docker?
  • Unable to connect to SQL Server Express container on host VM
  • 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.