DOcker 启动chrome问题解决

29 篇文章 1 订阅

注意:在docker里,尽量不要以root身份运行chrome,会报一些错误

1. "Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted".

docker run 时加上参数: --privileged

Why --privileged?

Chrome uses sandboxing, therefore if you try and run Chrome within a non-privileged container you will receive the following message:

"Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted".

The --privileged flag gives the container almost the same privileges to the host machine resources as other processes running outside the container, which is required for the sandboxing to run smoothly.


FYI, https://hub.docker.com/r/webnicer/protractor-headless/


2.Running Chromium inside Docker - Gtk: cannot open display: :0

root下执行命令:

xhost +

FYI, http://stackoverflow.com/questions/28392949/running-chromium-inside-docker-gtk-cannot-open-display-0


3.linux下xhost命令报错:unable to open display的解决办法

FYI, http://www.jb51.net/LINUXjishu/412923.html

linux系统中执行xhost命令报错,具体内容为,unable to open display,该怎么办呢?出现这个问题是因为,linux 下通过xhost进入图形界面,经常会出现报错“unable to open display”,详细解决办法请看下文

linux下执行xhost命令报错:unable to open display,解决方法,linux 下通过xhost进入图形界面,经常会出现报错“unable to  open display”

linux下的操作步骤如下:

1、复制代码:

复制内容到剪贴板
  1. [root@localhost ~]# vncserver   
  2.   
  3.         New 'localhost:1 (root)' desktop is localhost:1   
  4.   
  5.         Starting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/localhost:1.log   
  6.   
  7. [root@localhost ~]# export DISPLAY=localhost:1   
  8.   
  9. [root@localhost ~]# xhost +   
  10.   
  11.         access control disabled, clients can connect from any host   

在设置xhost时,出现unable to open display 的问题一般都能用上述方法搞定

2、以root用户登录

输入命令xdpyinfo,记录下里面的name of display:后的字符串,如 name of display:127.0.0.1:1.0

在执行xhost +命令(使得所有客户都可以访问)

返回信息为: access control disabled,clients can connect from any host

如果xhost +不能执行,可以输入命令export DISPLAY=:0执行一下

再执行xhost +

xhost + ip (name表示那个ip机器可以使用该服务)

以oracle用户登录

如果前面root登录下执行xdpyinfo后的name of display:后的字符串是127.0.0.1:1.0

那么在该oracle用户下执行一下export DISPLAY=:1.0

然后再执行xdpyinfo命令,如果能出现信息说明你已经成功了

这样估计就可以解决linux下安装oracle出现的xhost问题

3、电脑上下载安装Xshell 5

4、选择需要连接到哪一个Linux系统

5、输入用于连接的用户名和密码

6、输入用于连接的密码

7、单击这里的确定,开始连接

8、连接成功

9、命令startx提示信息


3.

Failed to connect to socket /var/run/dbus/system_bus_socket:No such file or directory

solution:

1> sudo apt-get install dbus

2>sudo /etc/init.d/dbus start



### 如何在Mac操作系统中通过Chrome浏览器有效使用或解决Docker相关问题 #### 使用特定配置启动容器中的Chrome实例 对于在M1 Mac上遇到的`@DockerBrowser`标签无法创建驱动程序的问题,这不仅限于Chrome,在其他浏览器也可能发生。当尝试在基于ARM架构的苹果电脑上的Docker容器内启动Chrome时遇到了困难[^1]。 #### 设置Linux环境下的Docker准备事项 为了确保能够顺利操作Docker容器内的应用(如Chrome),需确认已按照适当的方法完成了Docker的基础设置工作。例如,在类Unix系统环境下完成必要的软件包更新以及服务端口开放等准备工作[^2]。 #### 处理缓存占用过多资源的情况 由于Chrome会在运行过程中不断积累大量的临时数据,这些数据可能会迅速填满默认分配给Docker容器的空间,从而阻止进一步的操作执行。针对这种情况的一个解决方案就是将Chrome的缓存目录映射至主机系统的磁盘空间之外,以此来缓解存储压力并提高性能表现[^3]。 ```bash docker run -v /path/to/host/cache:/data/chrome-cache ... ``` #### 防止误下载错误版本的应用组件 有时因为网络原因或者其他因素的影响,可能导致用户意外获取到了不符合预期需求的文件版本。比如提到过的关于MATLAB插件安装失败的例子实际上是因为混淆了两个不同的项目名称而导致的结果;因此建议仔细核对官方文档说明,并留意网页提示信息以避免此类失误的发生[^4]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值