How to set screen resolution for GUI application running in a container

Hello all,

I’ve got a Python + Tkinter program that I’m running inside a container built from the python:3-alpine image. For whatever reason the widgets in the GUI are tiny. I’ve tried changing the resolution scaling factor directly using the mechanism provided by tkinter but this has no effect. I’ve tried increasing the size of the default font used for the text inside the widgets (as their size is defined in terms of characters wide + lines high) but this only makes the actual widget massive while the text remains tiny.

If I run the same program in a container built from the python:3 image (debian based), it’s much more acceptable but still not the same as if I run the program directly from the host. I’ve hosted three images that can be found here; the first is running on the host (debian bookworm) the second is running in a python:3 based conatiner and the third is running in a python:3-alpine based container.

As usual, any help is much appreciated (especially so for this one!)

Since you didn’t mention Docker DEsktop in your message. I have to start with the question, do you really use Docker Desktop for Linux or just Docker CE?

Hello!

Well I’m not too sure. I installed Docker Desktop but I never launch it, I just call docker build, docker run etc. from a terminal.

Does that help?

It could run in the baclground if you enabled starting it when you log in. Run the following commands to find it out:

docker version
docker context ls

Whether you are using Docker Desktop or Docker CE could make a difference and we can make sure the topic is in the right category, but I’m not sure I could help with the resolution issue. The container is not a virtual machine itself, so it does not have a monitor to configure its own screen resolution. And if I understand it correctly, your problem is not the screen resolution, but the font size.

Can you share more about what image you are using and how you start the container? Docker containers are not really for desktop apps. It is possible to run desktop apps in a container, but without knowing how exactly you did it, it would be hard to help. And I never really did it except a web browser container from an image that supported WEb bsed remote desktop to connect to the container.