Skip to content

Instantly share code, notes, and snippets.

@ilgrosso
Last active August 16, 2019 12:27
Show Gist options
  • Save ilgrosso/427541d042d133cde532946a0da1b892 to your computer and use it in GitHub Desktop.
Save ilgrosso/427541d042d133cde532946a0da1b892 to your computer and use it in GitHub Desktop.
Firefox on Docker

Based on http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/

  1. 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
  1. docker build -t firefox .
  2. docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix firefox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment