docker image with Google Puppeteer installed
base is alekzonder/docker-puppeteer
add NotoSansCJKjp font.
docker pull orangesys/docker-puppeteer:v0.10.2
- you should pass
--no-sandbox, --disable-setuid-sandbox
args when launch browser
const puppeteer = require('puppeteer');
(async() => {
const browser = await puppeteer.launch({
args: [
'--no-sandbox',
'--disable-setuid-sandbox'
]
});
const page = await browser.newPage();
await page.goto('https://www.google.com/', {waitUntil: 'networkidle'});
browser.close();
})();
- if you got page crash with
BUS_ADRERR
(chromium issue), increase shm-size on docker run with--shm-size
argument
docker run --shm-size 1G --rm -v <path_to_script>:/app/index.js orangesys/docker-puppeteer:v0.10.2
docker run --shm-size 1G --rm -v <path_to_script>:/app/index.js orangesys/docker-puppeteer:v0.10.2
docker run --rm \
-v <path_to_dir>:/app \
orangesys/docker-puppeteer:v0.10.2 \
node my_script.js