javascript - How to run headless browser inside docker? -


i building crawler headless browser right want dockerize app i've installed chrome in docker image throw me error when run script.

startchrome.js

const chromelauncher = require('chrome-launcher');  chromelauncher.launch({     port: 9222,     chromeflags: ['--headless','--proxy-server=54.171.181.204:8888','--disable-web-security','--disable-gpu'] }).then(chrome => {     console.log(`chrome debugging port running on ${chrome.port}`); }); 

err

(node:415) unhandledpromiserejectionwarning: unhandled promise rejection (rejection id: 1): error: connect econnrefused 127.0.0.1:9222 (node:415) [dep0018] deprecationwarning: unhandled promise rejections deprecated. in future, promise rejections not handled terminate node.js process non-zero exit code. 

and when run in command line throws me error this

failed move new namespace: pid namespaces supported, network namespace supported, failed: errno = operation not permitted trace/breakpoint trap 

you can try docker image yukinying/chrome-headless-browser or similar: https://hub.docker.com/r/yukinying/chrome-headless-browser/

from description:

this docker image contain linux dev channel chromium (https://www.chromium.org/getting-involved/dev-channel), required dependencies , command line arguments running headless mode.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -