mviereck / x11docker

Run GUI applications and desktops in docker and podman containers. Focus on security.
MIT License
5.62k stars 378 forks source link

run terminal only using GUI enabled docker image? #130

Closed biocyberman closed 5 years ago

biocyberman commented 5 years ago

I thought it is an easy switch of parameter, but it didn't work. Is it currently possible at all?

x11docker --tty -- x11docker/mate
x11docker WARNING: User user@localhost is member of group docker.
  That allows unprivileged processes on host to gain root privileges.

Unable to init server: Could not connect: Connection refused
mate-session[91]: Gdk-CRITICAL: gdk_display_get_name: assertion 'GDK_IS_DISPLAY (display)' failed
mate-session[91]: GLib-CRITICAL: g_setenv: assertion 'value != NULL' failed
Failed to run gnome-keyring-daemon: Failed to execute child process "gnome-keyring-daemon" (No such file or directory)

The GUI command work:

x11docker --desktop --nxagent -- x11docker/mate

mviereck commented 5 years ago

There are two related options: -t, --tty just does not start an X server. (x11docker/mate fails because CMD ["mate-session"] does not find one). -i, --interactive opens an interactive tty. This one works:

x11docker --tty --interactive -- x11docker/mate bash

Or short:

x11docker -ti x11docker/mate bash

Note that you need a shell like bash or sh as image command to make use of the interactive tty. You can also run without --tty to provide an X server and to have an interactive tty at the same time:

x11docker --desktop --interactive -- x11docker/mate bash
biocyberman commented 5 years ago

Yes I missed the -i option. It works now! Thanks