Docker容器中nodriver无法连接firefox-esr的问题求助
Docker容器中nodriver无法连接firefox-esr的问题求助
我想创建一个Docker镜像,用Python代码实现网站爬取。目前我用x11vnc提供虚拟显示器,firefox-esr作为浏览器,nodriver作为Python爬虫工具。
现在我已经能正常启动容器,并且通过TightVNC看到虚拟显示器,在交互式shell里也能手动启动firefox-esr。但当我用nodriver时,把/usr/bin/firefox-esr作为可执行路径传入,却无法启动浏览器,报错信息如下:
Failed to connect to browser
One of the causes could be when you are running as root.
In that case you need to pass no_sandbox=True
有没有大佬能帮我解决这个问题?
编辑补充:我的Dockerfile内容如下
FROM ubuntu RUN apt-get update RUN apt-get install software-properties-common -y RUN add-apt-repository ppa:mozillateam/ppa RUN apt-get update && \ apt-get install -y x11vnc xvfb firefox-esr && \ mkdir ~/.vnc && \ touch ~/.vnc/passwd RUN x11vnc -storepasswd ...
备注:内容来源于stack exchange,提问作者Daniele Lupo
相关产品推荐
相关产品推荐

