Run graphical process in Docker container, detach and reconnect to the running GUI

Let’s say I have some computations in Python that take a long time, and are run from the Spyder IDE so the results can be easily inspected and used for further work afterwards.

I want to run the Spyder process inside a Docker container that is hosted on a server machine (i. e. not the same machine I’m sitting in front of). I have already seen that it is possible to run e. g. LibreOffice and Chrome like that, so this should be possible. But these processes were not kept alive when the user detached from the container.

  • Should the docker production image needs code as volume or not
  • Can't get an interactive Docker shell inside screen
  • Custom Docker Repository URL for Artifactory and Jenkins
  • Docker-compose failing to run a jar file but works with Dockerfile
  • How to remove file/folder from Docker container without starting this container
  • Tensorflow docker export weights
  • Now the question is: is there a way to open a Spyder process within a Docker container, start the computations manually, detach from the Docker container, and afterwards reconnect to the container so I return to the still running Spyder GUI to be able to inspect the outcome of the computations and keep working with them?

    To keep it simple for the users (which would be multiple people, but each with their own container), I would not want to have to save the computation results to a file a re-read them for further processing.

    With IPython, I could probably simply use screen to keep the interpreter alive. But I would not know how to achieve the same thing with Spyder. Can I maybe somehow “connect” Spyder to a remote IPython interpreter?

    The solution:

    Thanks to @JanSuchotzki, I was able to get a X11-VNC-server-container running alongside a client container where Spyder is installed and that can use the server container for displaying graphics. After additionally setting an environmental variable USER, I’m able to run Spyder successfully. Only the screen size of the X11-server needs to be adjusted not to cut off the edge of the Spyder GUI, then everything works great!

  • where does docker attach volume on host machine when its not specified?
  • docker stack deploy do not remove services that are not declared in the current yaml compose file
  • libgit2 alpine linux docker error
  • Docker Issue -Image State not getting saved
  • Mongo Docker not creating user
  • Specifying the creation of a sudo user in a Dockerfile?
  • 2 Solutions collect form web for “Run graphical process in Docker container, detach and reconnect to the running GUI”

    When running on a remote machine you might want to go with something like VNC. That basically means your container running Spyder also serves as a VNC-Server. Now you can attach via VNC-Client to the container and check what the current state is (interact with your IDE).

    This will also work in a multi-user setup assuming each container, or better to say the VNC-server running inside, works on another port. Then you can simply distinguish the different containers by port.

    I have created a base-image for running an debian based container with X-Server and VNC-Server. You can have a look on my Docker-Hub Account. There you will find an image for client and for server.

    I’m not familiar with Sypder, but I think you’ll want to start by looking at the Docker docs regarding networking and exec.

    Another thought: If you can tell Spyder to run as a server, you could connect a client via an exposed port.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.