Skip to content

Instantly share code, notes, and snippets.

@ndunks
Created February 25, 2023 06:08
Show Gist options
  • Save ndunks/4682237e43d9252e6726c4d07e681f91 to your computer and use it in GitHub Desktop.
Save ndunks/4682237e43d9252e6726c4d07e681f91 to your computer and use it in GitHub Desktop.
Docker with X Graphical browser chrome
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y chromium-browser
RUN export uid=1000 gid=1000 && \
mkdir -p /home/user && \
echo "user:x:${uid}:${gid}:User,,,:/home/user:/bin/bash" >> /etc/passwd && \
echo "user:x:${uid}:" >> /etc/group && \
echo "user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
chown "${uid}:${gid}" -R /home/user
# chmod 0440 /etc/sudoers.d/user && \
RUN apt install xauth
USER user
ENV HOME /home/user
CMD '/bin/bash'
#CMD ['chromium-browser', '--no-sandbox']
# docker build -t chromium .
# docker run --net=host --name chrome -it --rm -e DISPLAY=$DISPLAY -e XAUTHORITY=$XAUTHORITY -v $XDG_RUNTIME_DIR:$XDG_RUNTIME_DIR chromium
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment