How to run browser based cucumber tests using grunt in docker container

I have a set of unit tests which needs to be executed after each build. For this scenario, after each build I am creating a docker container and for running cucumber tests.

Those test cases needs chrome for execution. I have installed chrome on docker but when unit tests are initiated they timeout as unit test cases are not able to access the browser.

Below is the grunt code for running unit tests in browser:

'use strict';

const path = require('path');

module.exports = (grunt) => {


        // Configuration to be run (and then tested).
        chrome_headless: {
            options: {
                args: ['--disable-gpu']
            default_options: {
            custom_options: {
                options: {
                    port: 9999
        env: {
            chrome: {
                PLATFORM: 'ChromeCanary',
                base: 'ChromeCanary',
                flags: [
                    // See
                    // Without a remote debugging port, Google Chrome exits immediately.
                    ' --remote-debugging-port=9222',
            firefox: {
                PLATFORM: 'FIREFOX'

        jshint: {
            all: ['Gruntfile.js', 'features/step_definitions/*.js', 'features/support/*.js'],
            options: {
                node: true,
                strict: "global",
                esversion: 6

        exec: {
            run_cucumber_tests: {
                command: path.join('node_modules', 'cucumber',  'bin', 'cucumber.js')


    grunt.registerTask('default', ['env:chrome', 'exec']);
    //grunt.registerTask('chrome', ['env:chrome', 'jshint', 'exec']);
    //grunt.registerTask('firefox', ['env:firefox', 'jshint', 'exec']);


Can anyone please suggest me how this can be achieved...