Skip to content

Docker, QML, XServer on Windows

egolus edited this page Nov 17, 2015 · 9 revisions

Problems and hopefully solutions to run our app on windows

Docker

a provider is needed. Standard is Virtual box, possible is also Hyper-V

environment variables for the active docker machine are needed (docker-machine env can be used with the --shell parameter for cmd or powershell)

Vagrant

I still need to find a way to use it with Docker/Hyper-V. Maybe It's a little problem in the Vagrantfile

X-Server on the Windows-Client

to run a GUI-Application you need to forward X11 from the docker-container to the client

on the Client an X-Server needs to be installed, for example XMing

choco install xming

when starting XMing, I need the -ac argument to disable the access control check. Maybe I should try another X-Server later.

example command for XMing:

XMing -ac -multiwindow -clipboard

forwarding the X-Server from the docker-container - Basic proof of concept

I'll first try out this idea to share the X11 socket directly

  • create a new folder
  • create a Dockerfile:
FROM ubuntu:14.04

RUN apt-get update && apt-get install -y firefox

# 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

USER developer
ENV HOME /home/developer
CMD /usr/bin/firefox
  • run docker build -t firefox .
  • start the local X-Server: xming -ac
  • run docker run -ti -e DISPLAY=<Local IP>:<Display> firefox
    Display should be 0.0 if XMing isn't started with an extra display-argument
    *You can move this to a variable to mirror the nix behaviour: $DISPLAY="192.168.0.4:0"
    then run docker run -ti -e DISPLAY=$DISPLAY firefox

using qml over ssh and a shared X-Server

With the X-Server configurations shown above using qmlscene works in general. A working example is qml-material/styles_demo/main.qml

there are some errors and warnings in the log, but the Output in the X-Server works fine.

root@a3ca55226cd4:/usr/src/qml-material/styles_demo# qmlscene main.qml
failed to get the current screen resources
WARNING: Application calling GLX 1.3 function "glXCreatePbuffer" when GLX 1.3 is not supported!  This is an application bug! process 35: D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open "/etc/machine-id": No such file or directory
See the manual page for dbus-uuidgen to correct this issue.
QXcbConnection: XCB error: 170 (Unknown), sequence: 161, resource id: 90, major code: 146 (Unknown), minor code: 20