Firefox 在 docker 容器内崩溃

问题描述

尝试使用 X 窗口转发从 docker 容器启动 Firefox。每次都崩溃。

  • Firefox 版本容器 - Mozilla Firefox 60.8.0
  • Host os firefox 版本 - Mozilla Firefox 78.4.0esr
  • 操作系统 - Suse linux (SLES 15 SP2)

当我使用选项 --ipc= host 启动容器时,它工作正常。我可以从容器中打开浏览器。但是这种方法降低了容器的隔离性和安全性。

Firefox 崩溃报告跟踪 -

(firefox:29957): Gdk-ERROR **: The program 'firefox' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadValue (integer parameter out of range for operation)'.
  (Details: serial 520 error_code 2 request_code 130 (unkNown) minor_code 3)
  (Note to programmers: normally,X errors are reported asynchronously;
   that is,you will receive the error a while after causing it.
   To debug your program,run it with the GDK_SYNCHRONIZE environment
   variable to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
ExceptionHandler::GenerateDump cloned child 30085
ExceptionHandler::WaitForContinueSignal waiting for continue signal...
ExceptionHandler::SendContinueSignaltochild sent continue signal to child
./runbrowser.sh: line 43: 29957 Trace/breakpoint trap   (core dumped) 

这是我的 Docker 文件

FROM hc-us-east-aws-artifactory.cloud.abc.com/docker-prod/gui-apps:0.6
workdir /usr/g/applications//service
copY ./service/target/rcp-rest-1.8.5.jar ./plat/rcp-rest.jar
copY ./packageRPM/scripts/common ./scripts
copY ./packageRPM/scripts/container ./scripts
copY ./packageRPM/config ./config
RUN chmod -R 777 ./scripts
EXPOSE 8217
ENV disPLAY=:0.0
USER myuser
ENTRYPOINT ["sh","/usr/g/applications/entrypoint.sh"]

这是docker启动脚本

docker run --rm  \
         --name my-service \
         -v /tmp/.X11-unix:/tmp/.X11-unix:rw \
         -v /etc/localtime:/etc/localtime \
         -e TZ=`ls -la /etc/localtime | cut -d/ -f7-9` \
         -e spring_profiles_active=Prod \
         --network="host" \
         --pid=host \
         local/my-service:latest

请建议是否有其他选择。提前致谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)