Running the GUI in docker (without ssh, without VNC)

TL DR: root does not have to run a GUI application, set a regular user for this.

I am trying to run the arduino IDE (downloaded, not the package) from Docker. I wrote the Dockerfile as follows:

FROM ubuntu:14.04
MAINTAINER Mael Auzias <docker@mael.auzias.net>

ENV HOME /home/arduino
ENV USER arduino

RUN apt-get update && apt-get install -y \
   libx11-6 libxext-dev libxrender-dev libxtst-dev \
    --no-install-recommends \
    && useradd --create-home --home-dir $HOME $USER \
    && chown -R $USER:$USER $HOME

ADD arduino-1.6.6-linux64.tar.xz $HOME

WORKDIR $HOME/arduino-1.6.6
USER $USER

ENTRYPOINT ["/bin/bash"]

I took the time to understand how Jessica Frazel usually starts her graphic containers to properly run my command:

$docker run --name arduino --rm -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix 25af73b6cb3c ./arduino
No protocol specified
Picked up JAVA_TOOL_OPTIONS: 
No protocol specified
Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.

I installed straceand checked with xeyeswhat was wrong, and I get the following error:

connect(3, {sa_family=AF_LOCAL, sun_path=@"/tmp/.X11-unix/X0"}, 20) = -1 ECONNREFUSED (Connection refused)

Has anyone experienced this? Can someone point me to some document or see what I am doing wrong?

Any help would be appreciated.

PS: , ssh VNC. , unix .


...

root . su regular-user xterm xeyes, . , :/


Docker, Fedora 23. root, X. , , , bash arduino Java ( ).

docker build -t arduino-1.6.6 ., docker run --name arduino --rm -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix arduino-1.6.6 ./arduino arduino IDE.

- arduino --device -v, /dev/ttyUSB0.

FROM ubuntu:14.04
MAINTAINER Mael Auzias <docker@mael.auzias.net>

ENV HOME /home/arduino
ENV USER arduino

RUN apt-get update && apt-get install -y \
        libx11-6 libxext-dev libxrender-dev libxtst-dev \
        --no-install-recommends \
        && rm -rf /var/lib/apt/lists/* \
        && useradd --create-home --home-dir $HOME $USER \
        && chown -R $USER:$USER $HOME

ADD arduino-1.6.6-linux64.tar.xz $HOME
RUN sed -i 's/"-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"//g' /home/arduino/arduino-1.6.6/arduino

WORKDIR $HOME/arduino-1.6.6
USER $USER

ENTRYPOINT ["/bin/bash"]
+4
1

...

root . su regular-user xterm xeyes, . , :/


Docker, Fedora 23. root, X. , , , bash arduino Java ( ).

docker build -t arduino-1.6.6 ., docker run --name arduino --rm -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix arduino-1.6.6 ./arduino arduino IDE.

- arduino --device -v, /dev/ttyUSB0.

FROM ubuntu:14.04
MAINTAINER Mael Auzias <docker@mael.auzias.net>

ENV HOME /home/arduino
ENV USER arduino

RUN apt-get update && apt-get install -y \
        libx11-6 libxext-dev libxrender-dev libxtst-dev \
        --no-install-recommends \
        && rm -rf /var/lib/apt/lists/* \
        && useradd --create-home --home-dir $HOME $USER \
        && chown -R $USER:$USER $HOME

ADD arduino-1.6.6-linux64.tar.xz $HOME
RUN sed -i 's/"-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"//g' /home/arduino/arduino-1.6.6/arduino

WORKDIR $HOME/arduino-1.6.6
USER $USER

ENTRYPOINT ["/bin/bash"]
+3

Source: https://habr.com/ru/post/1618092/


All Articles