Closed m-bers closed 2 years ago
I'm not sure to understand how you would like to change DISPLAY_WIDTH
and DISPLAY_HEIGHT
while the container is running. Could you provide an example ?
In this case, I am connecting to a VM console that returns the resolution of the guest in the cli output.
And how you communicate the resolution to the container once you have it?
One way could be to use s6-overlay v3 which has support for ordered init scripts that mix longruns and oneshots
I could declare a oneshot service of my app that runs after xvfb first starts (since it needs an X server), filter out the resolution string in the CLI output, then stop xvfb (and my app) and start it again with the new resolution variable.
Sorry, I'm still not sure to fully understand what you are explaining...
But if I modify /var/run/s6/container_environment/DISPLAY_WIDTH
and then run killall Xvfb
, the new width is applied.
Could you have an init script that set the environment variable ? Or else define a service that monitors changes in resolution and apply it ?
Closing this issue. Please re-open if needed.
Note that latest images support remote resizing, meaning that the app is re-sizing according to the browser's window size.
I am running an image where the output of the CMD is being piped into sed to extract screen width/height values, and store them in
DISPLAY_WIDTH
andDISPLAY_HEIGHT
respectively.I have
KEEP_APP_RUNNING=1
so the container doesn't stop when services are restarted, but when I try to runs6-svc -h /run/s6/services/xvfb/
in an exec session as root it is using the old environment variables loaded from thedocker run
command. I also tried doing e.g.cat $DISPLAY_WIDTH > /run/s6/container_environment/DISPLAY_WIDTH
and it didn't pick that up either.I know dynamic resize via xrandr isn't working but it'd be great to do a one-time resize via restarting xvfb based on values returned in my entrypoint script. Also, when I try to do this directly from the entrypoint script I get permission denied since s6-svc needs to be run as pid 1. Any way around this other than setting
-e USER_ID=0 -e GROUP_ID=0
?Currently the only thing that actually works is mounting my .env file into the container, writing the
DISPLAY_WIDTH
andDISPLAY_HEIGHT
values there and doing a brand newdocker run
from the directory with the .env file. Needless to say this is not ideal.