繁体   English   中英

在本地主机上的 ubuntu docker 容器中运行 firefox:无法初始化服务器:不支持百老汇显示类型:

[英]Running firefox in a ubuntu docker container on localhost: Unable to init server: Broadway display type not supported:

我正在尝试从本地主机上的 docker 容器运行 X11 GUI 程序:

FROM ubuntu:20.04
RUN apt-get update && apt-get install -y firefox
ARG home=/root
WORKDIR $home
COPY entrypoint.sh .
ENTRYPOINT ["./entrypoint.sh"] 

entrypont.sh文件在哪里:

#! /bin/bash
firefox &
exec bash

使用以下方法构建图像:

docker build -t firefox-ubuntu-2004 . 

并运行容器(本地主机:Ubuntu 20.04):

XSOCK=/tmp/.X11-unix
XAUTH=/tmp/.docker.xauth
DISPLAY="localhost:0"
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
docker run -it --rm \
       -e DISPLAY=$DISPLAY \
       -v $XAUTH:$XAUTH \
       -v $XSOCK:$XSOCK \
       -e XAUTHORITY=$XAUTH \
       firefox-ubuntu-2004

运行最后一条命令的 output 错误消息是:

Unable to init server: Broadway display type not supported: localhost:0
Error: cannot open display: localhost:0

docker 命令中的--net=host应该可以完成这项工作

docker run --name myContainer -it --net=host  fromMyimage:latest

以及使用host.docker.internal而不是 localhost 来连接到 OSX 上的 docker 主机。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM