修改了python模块的docker? [英] docker with modified python modules?
问题描述
我使用docker通过在VM上进行pip安装来使用多个python软件包。现在,我已经为这些目的在这些模块中修改了两个文件。如何让docker在dockerfile中通过pip安装的文件上查看这些文件?我想,仅将修改后的python文件复制到工作目录中是行不通的吗?
I use docker to use multiple python packages via pip install on a VM. Now, I have modified for my purpose two files within those modules. How can I make docker to look at those files instead on the files installed via pip in dockerfile? I suppose, just copying the modified python files to the working dir will not work?
推荐答案
方法01:
步骤1:
像以前一样通过RUN pip install安装所需的模块
Install the required modules via RUN pip install as before
步骤2:
删除将在下一步中添加的文件
Remove the files that you will add in next step
步骤3:
将修改后的文件从当前目录复制到映像中的正确路径。
Copy the modified files from your current directory to the correct path in the image.
完成
方法02
Install everything in Dockerfile as before
Build the image
Run a container from that image
Exec into the container and modify the files
Get out of the conainer and commit the container as new image
这篇关于修改了python模块的docker?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!