Created
March 28, 2023 08:27
-
-
Save juliangaal/2a79e721345390021d52047d284d64ec to your computer and use it in GitHub Desktop.
Docker X11 Ubuntu 20.04
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:20.04 | |
RUN apt-get update && apt-get install -y x11-apps | |
ARG user=julian | |
ARG home=/home/$user | |
RUN groupadd -g 1000 $user | |
RUN useradd -d $home -s /bin/bash -m $user -u 1000 -g 1000 \ | |
&& echo $user:ubuntu | chpasswd \ | |
&& adduser $user sudo | |
WORKDIR $home | |
USER $user | |
ENV HOME $home | |
COPY entrypoint.sh . | |
ENTRYPOINT ["./entrypoint.sh"] |
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
#!/bin/bash | |
echo "DISPLAY=$DISPLAY" | |
xclock # x11 example application | |
echo "Done." | |
exec bash |
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
Instructions | |
============ | |
- Adapt user in Dockerfile to match yours | |
- build and run | |
chmod +x entrypoint.sh | |
docker build -t x11 . | |
docker run -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -h $HOSTNAME -v $HOME/.Xauthority:/home/$USER/.Xauthority x11 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment