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.

  • Mount a windows host directory in compose file version 3
  • Graylog container cannot connect to MongoDB container
  • docker containers need to be secure by default?
  • Running nvidia-docker with nouveau graphics drivers
  • How do I cleanly shut down a mesos-slave?
  • Ghost Blog on Ubuntu Snappy Core OS
  • 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!

  • docker service update: “image could not be accessed on a registry to record it's digest”
  • Unable to connect to unix:///var/run/docker.sock (Permission denied) from PHP code
  • Restart existing Docker container with port forwarding
  • How to define Kubernetes Job using a private docker registry?
  • Docker HttpExceptionRequest Can't GET from inside container
  • docker-compose up -d <name>; No such service: <name>
  • 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.