Connecting to a chrome instance running in a docker container through puppeteer locally and opening a localhost page
See original GitHub issueI am running headless chrome in a docker container and accessing it through puppeteer by running it locally using browerWSEndpoint. This part works fine. Once I get the connection established I try to use the instance to go to a localhost:port which fails and I get the following error:
Error: net::ERR_CONNECTION_REFUSED at http://localhost:port/ at navigate (path_to/node_app/puppet/node_modules/puppeteer/lib/Page.js:521:37) at anonymous at process._tickCallback (internal/process/next_tick.js:188:7)
- Puppeteer version:^1.2
- Platform / OS version: My puppeteer is running on my local machine which is MacOS 10.13.4 and the docker container is linux.
- Node.js version: v8.11.2
- I used the following for setting up headless chrome in my container. (Note: Didnot use the app folder but only chrome)
- Used puppeteer to connect to this chrome instance.
- Tried to open a localhost:<port>.
await page.goto("http://localhost:<port>", {waitUntil: 'networkidle0'});
Expected: Connection established and docker container stopping.
Actual: Error: net::ERR_CONNECTION_REFUSED at http://localhost:port/ at navigate (<path>/node_app/puppet/node_modules/puppeteer/lib/Page.js:521:37) at <anonymous> at process._tickCallback (internal/process/next_tick.js:188:7)
Thank you.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top GitHub Comments
Docker local isnt same as machine local. I used the hostname and it worked.