Reputation: 203
I am trying to run a headless instance of chromium within an ubuntu docker image but I keep getting the error this system has no display nor audio inputs or outputs
[0307/003516.533150:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
Is there anyway to disable dbus as it seems docker does not support it here are lines from my Dockerfile
FROM arm64v8/ubuntu:bionic
RUN apt install -y chromium-browser
RUN apt install -y chromium-drivers
Here is the launch line I use
chromium-browser --no-sandbox --headless --autoplay-policy=no-user-gesture-required --no-first-run --disable-gpu --use-fake-ui-for-media-stream --use-fake-device-for-media-stream --disable-sync index.html
Upvotes: 19
Views: 19113
Reputation: 1546
If you are running on apple silicon locally, choose "Use Rosetta for x86/amd64 emulation on Apple Silicon" in the Docker Desktop settings:
Otherwise you can try adding/running dbus:
apk add dbus
mkdir -p /run/dbus
dbus-daemon --config-file=/usr/share/dbus-1/system.conf --print-address
or
dbus-daemon --system
Upvotes: 1
Reputation: 5557
To have real headless chromium you will need to add the --remote-debugging-port
option to your line as follows:
chromium-browser --no-sandbox --headless --autoplay-policy=no-user-gesture-required --no-first-run --disable-gpu --use-fake-ui-for-media-stream --use-fake-device-for-media-stream --disable-sync --remote-debugging-port=9222 index.html
After launching, you can use the debugging port to connect and control the browser as described here
Upvotes: 12