Ubuntu Docker容器中的无头铬 [英] Headless chromium in ubuntu docker container

查看:98
本文介绍了Ubuntu Docker容器中的无头铬的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在ubuntu docker映像中运行无头铬实例,但我不断收到错误消息该系统没有显示器,也没有音频输入或输出

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

反正有禁用dbus的可能,因为docker不支持dbus这是我的Dockerfile中的行

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

这是我使用的发射线

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

推荐答案

要获得真正的无头铬,您需要在行中添加-remote-debugging-port 选项,如下所示:

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

启动后,您可以按照此处

这篇关于Ubuntu Docker容器中的无头铬的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆