[英]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.