'Cypress using Docker - Cypress could not verify that the server set as your `baseUrl` is running

I have my angular application up and running on localhost:4200. I started it using 'ng serve' on a terminal. I have the following in the cypress.json file:

{
  "baseUrl": "http://localhost:4200"
}

When running the cypress tests using the following Docker command: docker run -it -v $PWD:/e2e -w /e2e cypress/included:3.2.0, I get the error:

Cypress could not verify that the server set as your `baseUrl` is running:

  > http://localhost:4200

Your tests likely make requests to this `baseUrl` and these tests will fail if you don't boot your server.

Please start this server and then run Cypress again.

From google, I was able to find that Cypress is trying to find if the application is running on port 4200 inside the container. How do I fix this issue?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source