Based on http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/
- Create
Dockerfile
as follows:
FROM ubuntu:18.04
RUN apt-get update && apt-get install -y firefox
# Replace 1001 with your user / group id
RUN export uid=1001 gid=1001 && \
mkdir -p /home/developer && \
mkdir -p /home/developer/.cache/dconf && \
mkdir -p /etc/sudoers.d && \
echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \
echo "developer:x:${uid}:" >> /etc/group && \
echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \
chmod 0440 /etc/sudoers.d/developer && \
chown ${uid}:${gid} -R /home/developer
USER developer
ENV HOME /home/developer
CMD /usr/bin/firefox
docker build -t firefox .
docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix firefox