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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Approach 01:
Step 1:
Install the required modules via RUN pip install as before
Step 2:
Remove the files that you will add in next step
Step 3:
Copy the modified files from your current directory to the correct path in the image.
Done
Approach 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