Docker Community Forums

Share and learn in the Docker community.

Firefox not working with --no-remote with alpine based docker

(Mnhan32) #1

hey there,
I grab file from this site ,and everything works well. But it’s 3XX MB big image, and I want to make it smaller by using Alpine.
However, when I tried to do this based on Alpine, it’s not working.
Here is dockerfile I created.

RUN apk add --update firefox dbus &&
rm -rf /var/cache/apk/* &&
export uid=1000 &&
adduser -S -s /bin/sh -h /home/dummy -u $uid dummy &&
echo “dummy:$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c8)” | chpasswd

USER dummy
ENV HOME /home/dummy

CMD ["/usr/bin/firefox", “–no-remote”]

I do xhost + to allow all host using my host X11
build docker like this:

sudo docker build --no-cache=true --rm-true -f ./Dockerfile -t mnhan32/firefox:1.0 .

and I ran docker like:

sudo docker run --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --name d_firefox mnhan32/firefox:1.0

The docker ran, no msg output, no firefox ui, and close itself, probably because --rm option.
if I don’t use --no-remote, firefox opens but it seems to be using firefox on host.

Did I miss something? or Are there more packages that I need to installed to get this worked on Alpine?