-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support launching in Docker #59
Comments
thanks for the feedback @nathanboktae, these docs used to be more closely tied to the ones in Lighthouse that reference getting setup in CI/docker environments this dockerfile was once linked in the docs there for getting everything setup, but we'll have to figure out the dedicated chrome-launcher documentation story here :) |
The tricky thing seems to be intercepting |
@patrickhulce don't know if you can help me here but I'm having trouble in getting this to work in docker also. I'm trying to run a script which launches chrome then drives the browser using puppeteer.
However I seem to be getting this error.
My dockerfile looks like this,
Do you know where I could be going wrong or where I could look next? |
@jakelacey2012 what does You're passing |
Thanks for getting back to me.
from what I can see from printing the
|
yeah its a little weird because its not like the service at that URL isn't running from what I can see because if I remove
and I've tried selecting
specifically. |
@jakelacey2012 that means you're using a version of chrome that's not compatible with the version of puppeteer you're using. Each version of puppeteer is meant to be used with a very specific, fixed Chrome version. |
Ahh interesting! Do you know how I can find the right chrome version? In my dockerfile I'm specifying puppeteer 1.0.0 but my package.json i'm using
(The reason why I have different versions is because I had previous issue which one of my last projects and I had to use a specific version of puppeteer) |
Ahh https://github.com/GoogleChrome/puppeteer/blob/master/package.json#L11 hmm not sure how I can check or install this version though. |
Puppeteer automatically downloads a compatible version and sticks it in your node_modules for you, this is what it will use by default. Either way I suggest you find help over in their repo. You don't really need to use this library at all if you're primarily interested in using puppeteer :) |
Thanks for the help, I got it working. Really appreciate the help. Yeah its not immediately obvious why I'm using chrome-launcher from my explanation above, but the reason is because I want to leverage lighthouse to easily get metrics and from the examples I've seen is you need to link them in someway, I don't completely understand the why yet. And for any future travlers https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker this helped. |
I struggled with the relevant issue for a while. This is my code to launch Chrome in headless mode in Docker. function getChromeFlags(resolution: Resolution2D) {
let appendedOptions = headless ? ["--headless", "--disable-gpu"] : [];
return [
`--window-size=${resolution.width},${resolution.height}`,
...appendedOptions
];
}
const chrome = await ChromeLauncher.launch({
startingUrl: url,
chromeFlags: getChromeFlags(resolution)
}); Then I got this error.
I tried to use puppeteer workaround that @jakelacey2012 suggested. But actually that won't work for me. I could solve this problem by adding I hope this workaround is still safe for most of CI use case. |
@kyasbal-1994 the lighthouse-ci docs have a decent explanation of the tradeoffs involved in |
We have a CI environment at my company that does not have chrome nor allows
apt-get install
on our machines, but docker is available for better isolation of these dependencies, but I see no documentation or support for Docker. This would be greatly appreciated. I'm trying to get a shell script put together that can achieve this by passing in as aCHROME_PATH
, which may be the best, most unobtrustive way to support it. I'm struggling to get it working though :/The text was updated successfully, but these errors were encountered: