Skip to content
Advertisement

How can I use matplotlib.pyplot in a docker container?

I have a certain setting of Python in an docker image named deep. I used to run python code

JavaScript

For information, -v and -w options are to link a local file in the current path to the container.

However, I can’t use matplotlib.pyplot. Let’s say test.py is

JavaScript

I got this error.

JavaScript

With solution search, I am having only one solution. I figured out I can do if

JavaScript

My question is, instead of all those launching bash, setting xauth, and running Python inside container, can I do such setting with docker run so that I can just run the code outside of the container?

I tried

JavaScript

using --entry parameter, but it didn’t work. Please help.

Advertisement

Answer

Interestingly, I found quite nice and thorough solutions in ROS community. http://wiki.ros.org/docker/Tutorials/GUI

For my problem, my final choice is the second way in the tutorial:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement