LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Containers
User Name
Password
Linux - Containers This forum is for the discussion of all topics relating to Linux containers. Docker, LXC, LXD, runC, containerd, CoreOS, Kubernetes, Mesos, rkt, and all other Linux container platforms are welcome.

Notices


Reply
  Search this Thread
Old 03-21-2017, 12:27 PM   #1
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 651
Blog Entries: 135

Rep: Reputation: 188Reputation: 188
docker: x on no x


So let's imagine a working installed Linux operating system. It has docker. It has no x-windows, no gui at all. Right: now get and put in a container for docker that has x-windows. Do I now have x-windows running?
 
Old 03-22-2017, 05:49 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,848

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
running system-wide daemons (like dbus) inside the docker container is not trivial. but you can try...
 
Old 03-27-2017, 07:49 PM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Generally, I would recommend that any application that is running within a container should never try to avail itself of any host services that are not "by definition, universal."

"X-Windows" cannot be called "universal," because "there is only one of you!"
 
Old 03-28-2017, 10:45 AM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by jr_bob_dobbs View Post
So let's imagine a working installed Linux operating system. It has docker. It has no x-windows, no gui at all. Right: now get and put in a container for docker that has x-windows. Do I now have x-windows running?
Technically, you don't have x running.
What do you think docker is?
 
Old 04-13-2017, 06:03 AM   #5
simosx
Member
 
Registered: Jul 2005
Posts: 66

Rep: Reputation: 11
Talking

You can run GUI apps in an LXD container, and have them appear on your desktop with your other apps.

Here is an example:
Code:
lxc launch ubuntu:x mycontainer
lxc exec mycontainer -- apt update
lxc exec mycontainer -- apt install x11-apps
This creates a container called "mycontainer". Then, it runs a "apt updat" inside the container, then, it installs "x11-apps" which includes the "xclock" app.

You then need to be able to SSH into "mycontainer".
This means that you need to place your SSH public key in the account "ubuntu" (/home/ubuntu/.ssh/authorized_keys) in the container.
Here is how to do this:

Code:
cat ~/.ssh/id_rsa.pub | lxc exec mycontainer -- sudo --login --user ubuntu tee /home/ubuntu/.ssh/authorized_keys
Finally, let's run the "xclock" app in the container and have it appear on our desktop X.
Code:
ssh -X ubuntu@mycontainer.lxd xclock
You can expand this with more complex apps.
 
Old 04-19-2017, 12:58 PM   #6
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 651

Original Poster
Blog Entries: 135

Rep: Reputation: 188Reputation: 188
Quote:
Originally Posted by Habitual View Post
Technically, you don't have x running.
What do you think docker is?
Well, I must confess some confusion as to what docker is. By asking highly specific, carefully thought out ahead of time, questions I hope to build up a view of what docker actually does.

I've been researching as best as I can, but admit to a sort of conceptual block. It's the sort of thing that would be most likely resolved by actually running docker, but I've not been able to get docker working. D'oh! But that's beyond (and thus off-topic from) the (high specific) focus of this thread.

Thank you everyone for the replies.
 
Old 04-19-2017, 01:01 PM   #7
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 651

Original Poster
Blog Entries: 135

Rep: Reputation: 188Reputation: 188
Quote:
Originally Posted by simosx View Post
You can run GUI apps in an LXD container, and have them appear on your desktop with your other apps.
Is this something that only LXD can do, and not the other container methods?
 
Old 04-20-2017, 01:03 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,848

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
the problem is not the GUI itself, but the communication with other apps (like X server), using message bus (dbus daemon) and sockets (/tmp/.X11-unix/X0) which may or may not available from the container. And obviously you can have authentication related issues too.
 
Old 04-23-2017, 04:37 PM   #9
simosx
Member
 
Registered: Jul 2005
Posts: 66

Rep: Reputation: 11
Quote:
Originally Posted by jr_bob_dobbs View Post
Is this something that only LXD can do, and not the other container methods?
The "ssh -X" method can be used with any Linux server that has the X11 libraries, including containers.
The instructions that I gave above, are suitable for LXD.

It is also possible to run accelerated graphics by sharing the X11 devices to the container.
I am not sure how this would be configured with docker.
The accelerated graphics are required when playing games or running other graphics-intensive apps.
 
Old 05-03-2017, 12:03 AM   #10
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
I don't believe the X Windows server has to be running on the server for X Windows programs to run with the DISPLAY set to another host.
 
Old 05-03-2017, 12:18 AM   #11
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,848

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
there are a lot of different approaches, yes, and actually I have no idea what is the real goal (by OP).
X itself is a client-server app pair, and also there are GUI apps which will run and use that X server (not to speak about the daemons/services used by X). And at this moment I don't know which are supposed to run inside the docker and which parts should run "elsewhere".

By default/design docker is a "closed" container which means it is used to run something inside in a separated environment. Running X that way goes against this concept.
 
Old 05-04-2017, 10:20 AM   #12
simosx
Member
 
Registered: Jul 2005
Posts: 66

Rep: Reputation: 11
docker is an application container, while LXD is a machine container.

It is more natural to do these in LXD.
 
Old 05-18-2017, 12:21 PM   #13
tty0
LQ Newbie
 
Registered: Apr 2017
Posts: 2

Rep: Reputation: Disabled
It's possible to ran gui apps like chromium, libreoffice and a xorg server or desktop in separated containers. You need to share a DISPLAY env variable and some sockets (xorg) to get it running.
There is also a playonlinux image available to play games with wine.

It's possible to run a desktop from simple docker optimized and minimal os (minimal console with docker installed) like RancherOS or Linuxkit.

Because it's my first post I can't post links, so just seach for "github jessfraz dockerfiles" and "joriss playonlinux" for examples.


It's possible to run dbus, but you have to share the dbus policy files from applications with the dbus daemon container. But most applications running without dbus daemon

Last edited by tty0; 05-18-2017 at 12:22 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to install Docker and run Docker containers on Linux Mint 18/18.1 LXer Syndicated Linux News 1 12-13-2016 11:11 AM
LXer: Canonical and Docker Partner to Distribute Docker Releases as Snaps on Ubuntu LXer Syndicated Linux News 0 12-03-2016 09:57 PM
LXer: Docker Part 4: building and publishing custom docker images LXer Syndicated Linux News 0 04-08-2016 01:30 PM
LXer: Docker Engine 1.6 Debuts Alongside Docker Registry 2.0 and Compose 1.2.0 LXer Syndicated Linux News 0 04-17-2015 09:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Containers

All times are GMT -5. The time now is 04:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration