Docker构建:使用http缓存 [英] Docker build: use http cache
本文介绍了Docker构建:使用http缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的docker文件中有一步安装了python要求:
I have a step in my docker file that installs python requirements:
COPY req.txt /req.txt
RUN pip install -r /req.txt
我更改req.txt并添加/删除软件包
I change req.txt and add/remove packages to/from it frequently and rebuild the image.
码头工人是否可以使用http缓存来下载文件?
Is there a way for docker to use a http cache for downloaded files?
请不要建议我将docker文件更改为其他文件。
Please do not advise me to change my docker file to something else.
推荐答案
我以前是这样做的例如,建立第二张图片。您可以构建基本映像。
I used to do this by build a second image, for example. You can build a basic image.
FROM python
RUN pip install -r req.txt
并使用以下命令进行构建:
and build it with the following command:
docker build -t basic_python .
现在,如果要构建真正的映像,只需使用另一个docker文件即可:
For now, if you want to build your really image, just simply do it with another docker file:
FROM basic_python
RUN ....
CMD ....
这篇关于Docker构建:使用http缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文