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) => {

    grunt.initConfig({

        // 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: [
                    '--no-sandbox',
                    // See https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
                    '--headless',
                    '--disable-gpu',
                    // 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('grunt-chrome_headless');
    //grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-exec');
    grunt.loadNpmTasks('grunt-env');

    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...