Docker Python文件inputselect器
我试图configuration一个Docker镜像,以便用户可以input“docker run image”并popup一个窗口来selectinput文件。 我在创buildDocker镜像时尝试使用Tkinter,但是当它尝试加载Tkinter时Python脚本出错。
由于Tkinter没有工作,我试图切换到正常的input查询使用:
path= input('Input the file path:\n')
但是,现在我得到一个“EOFError:EOF阅读一条线”,当它到达input()行。
我的Dockerfile如下
FROM python:3 ADD script.py / RUN pip install xlrd RUN pip install numpy RUN pip install matplotlib CMD [ "python", "./script.py" ]
任何想法为什么发生这种情况? 我很新使用Docker,所以任何帮助将不胜感激:)
您需要使用docker run -ti image
运行容器,以确保它在连接terminal的情况下以交互模式运行。
运行X11 GUI应用程序有点棘手,因为您需要将容器访问到您的显示器。 这篇博文更详细地描述了这个过程。