Only mount xdg_runtime_dir when its env var is set

master
Hugo Thunnissen 3 months ago
parent c69803b176
commit f28d93bdfc

@ -237,7 +237,17 @@ func Run(privileged bool, detach bool, mounts []string, command []string) error
waylandDisplay := os.Getenv("WAYLAND_DISPLAY")
if waylandDisplay != "" {
// let's be a little forceful with wayland use if it's available
dockerCommand = append(dockerCommand, "-e", "GDK_BACKEND=wayland")
dockerCommand = append(dockerCommand,
"-e", "GDK_BACKEND=wayland",
"-e", "WAYLAND_DISPLAY="+waylandDisplay,
)
}
if xdgRuntimeDir != "" {
dockerCommand = append(dockerCommand,
"--mount", "type=bind,source="+xdgRuntimeDir+",target="+xdgRuntimeDir,
"-e", "XDG_RUNTIME_DIR="+xdgRuntimeDir,
)
}
dockerCommand = append(
@ -254,9 +264,6 @@ func Run(privileged bool, detach bool, mounts []string, command []string) error
"-e", "PULSE_SERVER=unix:/run/user/"+curUser.Uid+"/pulse/native",
"-e", "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/"+curUser.Uid+"/bus",
"-v", "/tmp/.X11-unix:/tmp/.X11-unix",
"-e", "WAYLAND_DISPLAY="+waylandDisplay,
"-e", "XDG_RUNTIME_DIR="+xdgRuntimeDir,
"--mount", "type=bind,source="+xdgRuntimeDir+",target="+xdgRuntimeDir,
"-v", "/dev/snd:/dev/snd",
"-e", "DISPLAY="+os.Getenv("DISPLAY"),
"-e", "XAUTHORITY="+os.Getenv("XAUTHORITY"),

Loading…
Cancel
Save