Im currently working on a project that requires to display a bunch of photos taken by a camera. I have a container only for taking this photos and they are sent via Redis to the other containers. (The is way more stuff but are irrelevant to the question).
Im trying to avoid a base desktop operating system as the idea is to launch at start docker containers and keep them running.
Now, I am trying to display those images as a video in real time (they are captured at 30fps).
Is there any way to achieve this without installing a desktop operating system? I thought on having a Ubuntu desktop inside a container and access to a phython program (i am programming everything in Python) that shows in a loop those frames.
My OS is Ubuntu 22.04 LTS
I ve seen that in my docker-compose i can add in volumes the X11 file to let Docker has access to display.
Basically, Ive tried to replicate this video:
But when I run echo $DISPLAY there isnt any display, although I have one connected using VGA. There is also a X11 Server running in root user, i am in a different one.
First I would like to know the viability of this, and if it is possible i will add more details ad I think the post is way to long. Or if there are better options Im open to any better ones. I just one a general opinion about this.
By the way, its for my final project at university so I can dedicate quite some time to it
You mentioned you don’t want GUI on the machine. Do you still have it? Or do you log in to the machine using SSH? I rarely try to run GUI in a container or work with X11 at all, but if I remember correctly, $DISPLAY is not set when you SSH into the machine. In that case you would need to send the GUI to a remote server using an IP address, but I don’t remember the way so if you are interested in it, you can try to search for it. I agree with @bluepuma77, but sometimes it could be useful to run some GUI apps even on a server. You could try something like https://hub.docker.com/r/linuxserver/firefox. Thre is web based RDP server in the container so you can use your browser to access the GUI. The image contains firefox, but the logic should work with something else too.
Thanks for the replies.
I have already done what @bluepuma77 said (Tried in another PC with an UBuntu Desktop). Then I guess I only need to launch a web browser in full screen automatically and connect throught localhost.
I was trying to avoid this idea because I guess it uses more resources and seems less “professional”. I would try to replicate the video (sorry it is in spanish, Im from Spain ) but this time in an Ubuntu Desktop. Basically, display directly what Docker is running.
For the project, it is compulsory to display those images in real time and store them, preferably all in one PC. It will also show other things in the future.
I connect using SSH and I have also tried to use the command echo locally without luck.
Just to fufil my curiosity and to investigate a bit. Would it be possible to display something trying something like this if my OS is only a terminal (without gui, I dont know if it the proper term)? Or I should give up?:
docker run -d --name firefox -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix firefox
Theorically, I have X11 server files and they are running. What I cant find is how to make the PC recognise the display. I remark, there is a display connected through VGA.
If X11 is the manager of the display and I let Docker access to them, it should work although there isnt gui in the base OS, right?
Edit: I forgot to mention, the purpose of having the UI inside Docker is to prevent that in a crash event it freezes the whole system. So, in case of fail the automatised process works as normal. That’s why I’m not coding a python program outside Docker with access to the Redis server (how the photos are sent), that manages all the UI. Of course, this in an desktop enviroment. I dont know if Pygame or a similar library of python works without gui.