Last active
June 2, 2022 20:52
-
-
Save dmouse/e76ce3d8dde00fe496da to your computer and use it in GitHub Desktop.
Run Firefox or Google Chrome into a Docker container | based on http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:14.04 | |
# Replace 1000 with your user / group id | |
RUN export uid=1000 gid=1000 && \ | |
mkdir -p /home/developer && \ | |
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 | |
RUN apt-get update && apt-get install -y firefox wget | |
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
RUN echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list | |
RUN apt-get update | |
RUN apt-get install google-chrome-stable dbus-x11 packagekit-gtk3-module libcanberra-gtk-module -y | |
USER developer | |
ENV HOME /home/developer | |
CMD dbus-daemon --system --fork && /usr/bin/firefox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker build -t browser . | |
docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix browser | |
docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix browser google-chrome |
Headless mode?
Is there a way to make this work with later versions of ubuntu, say 16.04 or 18.04? Getting error stuck on line /sudoers.d/ directory doesn't exist?
you can visit chrome-docker for help
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now check https://hub.docker.com/r/dmouse/browser/