Launching the container using only docker container run -it pigfoot/headless ...
will fail with some logs similar to #33.
Please use the 3 others ways to use Chrome Headless.
Launch the container using:
docker container run -it --rm -v $(pwd)/src:/app/src pigfoot/headless
and use the --no-sandbox
flag for all your commands.
Be careful to know the website you're calling.
Explanation for the no-sandbox
flag in a quick introduction here and for More in depth design document here
Launch the container using:
docker container run -it --rm --cap-add=SYS_ADMIN -v $(pwd)/src:/app/src pigfoot/headless
This allows to run Chrome with sandboxing but needs unnecessary privileges from a Docker point of view.
Thanks to ever-awesome Jessie Frazelle seccomp profile for Chrome. This is The most secure way to run this Headless Chrome docker image.
Also available here wget https://raw.githubusercontent.com/jfrazelle/dotfiles/master/etc/docker/seccomp/chrome.json
Launch the container using:
docker container run -it --rm --security-opt seccomp=$(pwd)/chrome.json -v $(pwd)/src:/app/src pigfoot/headless
docker container run -it --rm --security-opt seccomp=$(pwd)/chrome.json pigfoot/headless ./headless.sh https://httpbin.org/get