I've seen some chrome headless images floating around on dockerhub, however I'd like to build my own image based off debian.
FROM buildpack-deps:bookworm
RUN apt update && apt install -y chromium
chromium --headless --no-sandbox --disable-gpu --disable-software-rasterizer --disable-dev-shm-usage
[0518/234805.581627:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[0518/234805.586145:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[0518/234805.586179:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[0518/234805.590590:WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable.
How do I get around this issue? Is DBUS strictly required? How is this problem solved?
The solution described here (adding a --remote-debugging-port=9222
parameter) does not work for me: Headless chromium in ubuntu docker container
Okay I realized, that even if those errors are returned and it exits immediately, it still 'works'...
For example by passing additional parameters it does the expected (like taking a screenshot):
docker run \
--rm -it \
-v $PWD:/mypwd \
-w /mypwd \
--entrypoint chromium \
mydockerimage \
--headless \
--no-sandbox \
--disable-gpu \
--disable-software-rasterizer \
--disable-dev-shm-usage \
--screenshot \
--hide-scrollbars \
https://www.chromestatus.com/