slideflow icon indicating copy to clipboard operation
slideflow copied to clipboard

Docker compatibility for Slideflow Studio

Open jamesdolezal opened this issue 2 years ago • 5 comments

Feature

Compatibility and feature testing when running Slideflow Studio from Docker containers (as referenced in #240)

Additional context

GLFW OpenGL rendering and Tkinter both theoretically support Docker, so this should be possible to support.

jamesdolezal avatar Mar 29 '23 22:03 jamesdolezal

Hi, I was able to launch slideflow studio on docker running:

xhost + 
docker run -it --rm -e DISPLAY=:0.0 --network=host --privileged     -v /dev:/dev     -e DISPLAY=$DISPLAY     -v /tmp/.X11-unix:/tmp/.X11-unix     -v $HOME/.Xauthority:/root/.Xauthority    jamesdolezal/slideflow:latest-tf

And inside the container:

apt update
apt install python3-tk

Not sure if all the parameters are mandatory

mdrio avatar Oct 04 '23 08:10 mdrio

Thank you for reporting this! That's great news. I'll update the dockerfiles to install python3-tk and include these instructions in the documentation.

To clarify, this should work with the following command:

docker run -it --rm \
    -e DISPLAY=$DISPLAY \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    jamesdolezal/slideflow:latest-tf

However, on some distributions, you may need to run the following (on the host machine, not in the container):

sudo apt-get install x11-xserver-utils
xhost +local:docker

You can also forward the display output over SSH with X11 forwarding. SSH using the -X flag:

ssh -X user@destination

Then start the docker image. When forwarding over SSH, I had to use different flags:

docker run -it --rm \
    -e DISPLAY=$DISPLAY \
    -v $HOME/.Xauthority:/root/.Xauthority \
    --net=host \
    jamesdolezal/slideflow:latest-tf

jamesdolezal avatar Oct 25 '23 20:10 jamesdolezal

Hi, thank you for the great tool!

I'd like to launch Slideflow Studio on docker and access it from the client PC. I followed your instruction and run

slideflow-studio

, but I got the following error:

/usr/local/lib/python3.8/dist-packages/glfw/__init__.py:916: GLFWError: (65543) b'GLX: Failed to create context: BadValue (integer parameter out of range for operation)'
  warnings.warn(message, GLFWError)
python3: /builds/florianrhiem/pyGLFW/glfw-3.3.8/src/window.c:530: glfwSetWindowPos: Assertion `window != ((void *)0)' failed.
Aborted (core dumped)

. The same error occurred when I ran

python -m slideflow.studio

How can I resolve this?

I'm looking forward to hear from you. Thank you.

dakomura avatar Jan 11 '24 07:01 dakomura

It looks like GLFW (the window management library Studio uses) is having trouble finding an active X server. This is a common issue when attempting to run GUI applications in a Docker container.

The following additional details will help us look for a solution:

  1. What operating system is the container being run on?
  2. What command did you use to run the container?
  3. Is the container being run locally (on a machine with a display output), or remotely? If remotely, how is the display output being forwarded?

jamesdolezal avatar Jan 11 '24 14:01 jamesdolezal

  1. What operating system is the container being run on? -> Ubuntu 20.04.6 LTS or CentOS Linux 7 (I received the same error message on both operating systems).

  2. What command did you use to run the container? ->

docker run -it --rm \
        -e DISPLAY=$DISPLAY \
        --net=host \
        -v $HOME/.Xauthority:/root/.Xauthority \
        -v /tmp/.X11-unix:/tmp/.X11-unix \
        jamesdolezal/slideflow:latest-tf
  1. Is the container being run locally (on a machine with a display output), or remotely? If remotely, how is the display output being forwarded? -> It is being run remotely. After logging in the remote server using ssh -X user@destination, I confirmed that DISPLAY=localhost:10.0 was set. I also verified that xeyes was successfully forwarded remotely in the docker container.

Thank you.

dakomura avatar Jan 12 '24 03:01 dakomura