简体   繁体   English

如何在 docker 容器中使用 plt.savefig() 保存到我的主目录

[英]How do I use plt.savefig() within docker container to save to my home directory

I am running docker on an Ubuntu server.我在 Ubuntu 服务器上运行 docker。 Essentially I've created a container that produces plots using matplotlib, but I'm unsure how to get them to save to my home directory so that I can see the plots outside of the container.本质上,我已经创建了一个使用 matplotlib 生成绘图的容器,但我不确定如何将它们保存到我的主目录中,以便我可以看到容器外的绘图。 Can anyone possibly advise please?任何人都可以请指教吗?

You need to setup a volume from your docker container to link a persisting storage unit.您需要从 docker 容器设置一个来链接持久存储单元。

You could then set this to be your home drive, here is a question on this (but it also uses more advanced docker concepts like compose)然后您可以将其设置为您的主驱动器, 这是一个关于此的问题(但它也使用更高级的 docker 概念,如 compose)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM