DEV Community

Discussion on: Do you use Docker?

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

I absolutely have to use Docker, when there are build dependencies, like platform specific installs, and Makefiles. Like Golang sometimes, and native postgresql extensions.

I wonder if I can use Docker to run non-web GUI apps. I want to avoid VirtualBox.

Of course, I realize that VSCode can be dockerized, but I haven't tried it.

Collapse
 
thomashighbaugh profile image
Thomas Leon Highbaugh

x11docker in case turning on the socket is a little much for you which I wouldn't blame you for but Jonathan's solution is rather elegant

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

Thanks, it works. Although I need to install x11docker for AUR, instead of classic installation.

yay -S x11docker
x11docker --update-master
docker pull x11docker/kaptain
Enter fullscreen mode Exit fullscreen mode
Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

My first x11docker project. I cannot run with library/debian for x11docker/lxde, though.

FROM x11docker/lxqt
RUN apt-get update
RUN apt-get install -y wget build-essential bzip2 xdg-utils
RUN wget -q https://github.com/ankitects/anki/releases/download/2.1.26/anki-2.1.26-linux-amd64.tar.bz2
RUN tar -xf anki-2.1.26-linux-amd64.tar.bz2
RUN cd anki-2.1.26-linux-amd64 && make && make install

RUN apt-get install -y locales libnss3 mpv
RUN sed -i '/en_US.UTF-8/s/^#//g' /etc/locale.gen
RUN locale-gen
ENV LC_ALL=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US.UTF-8
Enter fullscreen mode Exit fullscreen mode
#!/bin/sh

x11docker \
    --xpra --clipboard --pulseaudio --no-entrypoint --home=$PWD/home \
    -- \
    -- patarapolw/anki2.1.26 anki
Enter fullscreen mode Exit fullscreen mode
Collapse
 
gealber profile image
Gealber Morales

This is very interesting, I've never try it myself 🙂.

Collapse
 
aghost7 profile image
Jonathan Boudreau

You can easily do this on Linux by mounting the x11 socket. For other platforms it isn't so simple.

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

Please elaborate / suggest an article...

Like Xorg on different ports?

Thread Thread
 
aghost7 profile image
Jonathan Boudreau

You can use the same Xorg instance:

docker run --rm -ti -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix ubuntu:focal bash
apt update
apt install -y peek
peek
Enter fullscreen mode Exit fullscreen mode
Thread Thread
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited
root@1c26d4121e74:/# peek
No protocol specified

(peek:3525): Gtk-WARNING **: 10:24:14.930: cannot open display: :0
root@1c26d4121e74:/#
Enter fullscreen mode Exit fullscreen mode

I am on GNOME40 on Xorg.

Thread Thread
 
aghost7 profile image
Jonathan Boudreau

Maybe its related to me being on rootless docker? Might be that you need to create a user with the same uid as the host for your case.