MintPy icon indicating copy to clipboard operation
MintPy copied to clipboard

matplotlib GUI in a Docker container

Open yunjunz opened this issue 2 years ago • 0 comments

In the docker container, testings, including MintPy/tests/smallbaselineApp.py, on my laptop work very well, except for one issue: when I started an interactive shell session as below, view.py seems to work well (normal print-out messages), except that the plotting window is not popping up. Any idea?

docker run -it -v ~/data:/home/mambauser/data --name mintpy ghcr.io/insarlab/mintpy:latest
cd data/test/FernandinaSenDT128/mintpy
view.py velocity.h5

FYI, view.py velocity.h5 --nodisplay also works (successfully plotted and saved the figure into a file). So this seems to be an interactive plotting window issue.

Originally posted by @yunjunz in https://github.com/insarlab/MintPy/pull/696#pullrequestreview-1014546141

The issue does come down to X.Org windows system issue, that is a bit annoying to work around and can induce some security risks. Further reading:

  • https://stackoverflow.com/questions/46018102/how-can-i-use-matplotlib-pyplot-in-a-docker-container
  • https://mybyways.com/blog/running-linux-gui-applications-in-a-docker-container-using-xpra

There's a couple tools that solve a lot of the issues that are more-or-less straightforward to use that set up X.Org windows system between the host and the container:

But since we include Jupyter, that's the easiest/best path to plotting figures in the container.

Originally posted by @jhkennedy in https://github.com/insarlab/MintPy/issues/696#issuecomment-1169016068

yunjunz avatar Jun 28 '22 18:06 yunjunz