firefox in docker and ssh tunnel

How to run firefox inside a docker container?

firefox in docker

Adapted from [1] for debian:jessie-slim:

FROM debian:jessie-slim

RUN apt-get update && \
        apt-get install -y firefox-esr && \
        apt-get clean

RUN groupadd --gid 1000 user && \
        useradd --uid 1000 --gid 1000 --create-home user

USER user
CMD /usr/bin/firefox-esr

Build the image:

sudo docker build -t firefox .

Forwarding X over Unix socket:

xhost +local:
sudo docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix firefox

ssh tunnel

ssh -f -L -N

If you edit /etc/hosts in the container to make localhost.



[1]DinoTools, "Firefox im Docker Container",


[2]Bo Jeanes, "The Black Magic Of SSH",