teracyhq / docker-files

Teracy docker-files project to build common Docker images
https://hub.docker.com/r/teracy/
MIT License
92 stars 55 forks source link

Running `ng test` fails to start chrome browser #14

Closed danimbrogno closed 7 years ago

danimbrogno commented 7 years ago

Hi, thanks for the image. I'm having trouble getting ng test to run. Here is my docker-compose.yaml:

version: '2'
services:
  test-web-app:
    image: teracy/angular-cli
    command:
      - ng
      - test
    working_dir: /usr/src
    volumes:
      - "./:/usr/src"

when I run docker-compose run test-web-app

I get the output

Starting virtual X frame buffer: Xvfb.
Executing command ng test
25 01 2017 14:35:22.023:WARN [karma]: No captured browser, open http://localhost:9876/
25 01 2017 14:35:22.047:INFO [karma]: Karma v1.2.0 server started at http://localhost:9876/
25 01 2017 14:35:22.049:INFO [launcher]: Launching browser Chrome with unlimited concurrency
25 01 2017 14:35:22.093:INFO [launcher]: Starting browser Chrome
25 01 2017 14:35:22.406:ERROR [launcher]: Cannot start Chrome

25 01 2017 14:35:23.481:INFO [launcher]: Trying to start Chrome again (1/2).
25 01 2017 14:35:23.581:ERROR [launcher]: Cannot start Chrome

25 01 2017 14:35:23.803:INFO [launcher]: Trying to start Chrome again (2/2).
25 01 2017 14:35:23.927:ERROR [launcher]: Cannot start Chrome

25 01 2017 14:35:24.087:ERROR [launcher]: Chrome failed 2 times (cannot start). Giving up.
hoatle commented 7 years ago

thank you for your report, let me check on this.

hoatle commented 7 years ago

I'm having this problem https://github.com/angular/angular-cli/issues/4207#issuecomment-275401101 will check back in some days.

hoatle commented 7 years ago

@danimbrogno have you configured customLaunchers and used it? https://github.com/teracyhq/angular-boilerplate/blob/082a879c5df3fa0ae6ddc000d84512754b62a642/karma.conf.js#L36

docker-compose run test-web-app (to execute the command: ng test --browsers Chrome_no_sandbox)

hoatle commented 7 years ago

under my investigation, it works as expected, so closed now.

If you still need our help, don't hesitate to re-open this issue with your sample project that we could check it out.

danimbrogno commented 7 years ago

This helped, I can run the command from a /bin/bash shell inside the container and it launches fine and executes the tests. But, when running docker-compose run test-web-app the same problem occurs, although I see in the output that it is using the Chrome_no_sandbox launcher. If you have any immediate suggestions it'd be appreciated. Otherwise I'll keep digging and if I don't get anywhere I'll publish a repo.

hoatle commented 7 years ago

@danimbrogno we're going to release v0.1.0 of angular-boilerplate, please give it a try https://github.com/teracyhq/angular-boilerplate unit tests and e2e tests work.