15

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
maxwellpwang
  • 163
  • 1
  • 1
  • 6

1 Answers1

13

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

jordanvrtanoski
  • 5,104
  • 1
  • 20
  • 29