在树莓派上的docker容器中运行firefox

时间:2018-08-20 06:30:15

标签: docker firefox raspberry-pi x11

我关注了this主题

构建可在Raspberry pi上运行的docker容器。我已经设法在普通centos上运行它,但是在pi上我总是遇到此错误(我一直在Windows 10的mobaxterm应用程序中运行,因为它具有x11支持):

Unable to init server: broadway display type not supported 'machinename:0'
Error: cannot open display: machinename:0

我尝试使用2个不同的dockerfile(第一个)构建它:

FROM    resin/rpi-raspbian:latest
# Make sure the package repository is up to date
RUN     apt-get update && apt-get install -y firefox-esr

USER root
ENV HOME /root
CMD /usr/bin/firefox

并尝试使用此脚本运行它:

#!/usr/bin/env bash

CONTAINER=firefox_wo_vnc
COMMAND=/bin/bash
DISPLAY="machinename:0"
USER=$(whoami)


docker run -ti --rm \
   -e DISPLAY \
   -v "/c/Users/$USER:/home/$USER:rw" \
   $CONTAINER
   $COMMAND

我得到了错误:(

我尝试过的第二个:

# Firefox over VNC
#
# VERSION               0.1
# DOCKER-VERSION        0.2

FROM    resin/rpi-raspbian:latest
RUN     apt-get update

# Install vnc, xvfb in order to create a 'fake' display and firefox
RUN     apt-get install -y x11vnc xvfb firefox-esr
RUN     mkdir ~/.vnc
# Setup a password
RUN     x11vnc -storepasswd 1234 ~/.vnc/passwd
# Autostart firefox (might not be the best way to do it, but it does the trick)
RUN     bash -c 'echo "firefox" >> /.bashrc'

并尝试运行:

#!/usr/bin/env bash

CONTAINER=firefoxvnc
COMMAND=/bin/bash
DISPLAY="machinename:0"
USER=$(whoami)

docker run \
    -it \
    --rm \
    --user=$USER \
    --workdir="/home/$USER" \
    -v "/c/Users/$USER:/home/$USER:rw" \
    -e DISPLAY \
    $CONTAINER \
    $COMMAND

这样,我可以通过VNC登录,但是firefox不在运行,而且实际上看不到任何东西,只是一个空的桌面。

我读了很多线程,已经安装了xorg,openbox,x11应用程序...

0 个答案:

没有答案
相关问题