在Dockerfile中,我有一个要安装的层requirements.txt
:
FROM python:2.7
RUN pip install -r requirements.txt
当我构建Docker映像时,无论对该文件进行任何更改,它都会运行整个过程。
如何确保仅pip install -r requirements.txt
在文件发生更改的情况下运行Docker ?
Removing intermediate container f98c845d0f05
Step 3 : RUN pip install -r requirements.txt
---> Running in 8ceb63abaef6
Collecting https://github.com/tomchristie/django-rest-framework/archive/master.zip (from -r requirements.txt (line 30))
Downloading https://github.com/tomchristie/django-rest-framework/archive/master.zip
Collecting Django==1.8.7 (from -r requirements.txt (line 1))
docker build
(和您的Dockerfile
)的输出。据推测,这是破坏缓存的构建过程中的较早步骤,导致此步骤运行。