Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add XSock forwarding for job #162

Open
Enteee opened this issue Apr 22, 2019 · 1 comment
Open

Add XSock forwarding for job #162

Enteee opened this issue Apr 22, 2019 · 1 comment

Comments

@Enteee
Copy link

Enteee commented Apr 22, 2019

Under Linux we can containerize graphical applications by mounting the X socket inside the container. I normally achieve this starting the container with the following script:

#!/usr/bin/env bash
set -ex

IMAGE="${1?Image not given}"

XSOCK=/tmp/.X11-unix
XAUTH=$(mktemp --suffix .xauth)

xauth nlist "${DISPLAY}" | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
docker run -ti \
  --network host \
  --publish-all \
  -e "DISPLAY=$DISPLAY" \
  -e "XAUTHORITY=$XAUTH" \
  -v "$XSOCK:$XSOCK" \
  -v "$XAUTH:$XAUTH" \
  "${IMAGE}"

It would be nice, if dobi could provide an option (X-forward) which does this. Obviously this would be a Linux/X.Org Server only thing.

@siredmar
Copy link
Contributor

You always can create a mount point in dobi that redicts to any files on the host. e.g. the X11 socket or an .Xauthority file.

mount=mount-tmp-x11-unix:
  bind: /tmp/.X11-unix
  path: /tmp/.X11-unix

Using this dobi job to execute qtcreator in a container image:

job=launch-qtcreator:
  use: image-qtcreator-5.12.2
  depends: [image-qtcreator-5.12.2]
  privileged: true
  mounts: 
  - mount-home-dir
  - mount-tmp-x11-unix
  - mount-dev
  interactive: true
  env:
    - "DISPLAY={env.DISPLAY}"
    - "LOCAL_USER_ID={user.uid}"
  annotations:
    description: "-> launch qt creator"  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants