Skip to content

Instantly share code, notes, and snippets.

@codefionn
Created December 4, 2021 10:48
Show Gist options
  • Select an option

  • Save codefionn/3724b1fa4ecdd8a19c4bb4e9b3a2e3a7 to your computer and use it in GitHub Desktop.

Select an option

Save codefionn/3724b1fa4ecdd8a19c4bb4e9b3a2e3a7 to your computer and use it in GitHub Desktop.
### This is a YAML representation of the profile.
### Any line starting with a '# will be ignored.
###
### A profile consists of a set of configuration items followed by a set of
### devices.
###
### An example would look like:
### name: onenic
### config:
### raw.lxc: lxc.aa_profile=unconfined
### devices:
### eth0:
### nictype: bridged
### parent: lxdbr0
### type: nic
###
### Note that the name is shown but cannot be changed
config:
environment.DISPLAY: :0
environment.PULSE_SERVER: 127.0.0.1:4713
environment.XAUTHORITY: /home/ubuntu/.Xauthority
environment.XDG_SESSION_TYPE: x11
environment.XSOCKET: /mnt/X11-unix/X0
user.user-data: |
#cloud-config
runcmd:
- 'mkdir -p /mnt/X11-unix'
- 'chmod 0777 /mnt/X11-unix'
- 'mkdir -p /mnt/1000/pulse'
- 'chown -R ubuntu:ubuntu /mnt/1000'
packages:
- x11-apps
- mesa-utils
- pipewire
description: GUI LXD profile for Xorg
devices:
PipeWire:
bind: container
connect: unix:/run/user/1000/pipewire-0
gid: "1000"
listen: unix:/mnt/1000/pipewire-0
mode: "0777"
security.gid: "1000"
security.uid: "1000"
type: proxy
uid: "1000"
PipeWireLck:
path: /mnt/1000/pipewire-0.lock
readonly: "true"
source: /run/user/1000/pipewire-0.lock
type: disk
PulseAudioPort:
bind: container
connect: tcp:127.0.0.1:4713
listen: tcp:127.0.0.1:4713
type: proxy
PulseAudioSocket:
bind: container
connect: unix:/run/user/1000/pulse/native
gid: "1000"
listen: unix:/home/ubuntu/.pulse-native
mode: "0666"
security.gid: "1000"
security.uid: "1000"
type: proxy
uid: "1000"
X0:
bind: container
connect: unix:/tmp/.X11-unix/X0
gid: "1000"
listen: unix:/tmp/.X11-unix/X0
mode: "0777"
security.gid: "1000"
security.uid: "1000"
type: proxy
uid: "1000"
dri:
path: /dev/dri
source: /dev/dri
type: disk
gamectl:
path: /dev/input
source: /dev/input
type: disk
mygpu:
type: gpu
snd:
path: /dev/snd
source: /dev/snd
type: disk
name: gui
used_by: []
@codefionn
Copy link
Author

LXD-Profile for Launching X11-GUI apps in a ubuntu container.

@codefionn
Copy link
Author

important, allow xhost passthrough:

xhost +local:container-hostname

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment