docker-compose不下载添加到requirements.txt文件

时间:2017-03-06 17:53:00

标签: django docker docker-compose

我有一个在docker中运行的Django项目。 当我将一些包添加到我的requirments.txt文件中时,当我运行docker-compose up时它们不会被下载

以下是我的Dockerfile中的相关命令:

ADD ./evdc/requirements.txt /opt/evdc-venv/
ADD ./env-requirements.txt /opt/evdc-venv/

# Active venv
RUN . /opt/evdc-venv/bin/activate && pip install -r /opt/evdc-        venv/requirements.txt
RUN . /opt/evdc-venv/bin/activate && pip install -r /opt/evdc-venv/env-requirements.txt

似乎docker正在使用我的requirements.txt文件的缓存版本,就像我将shell放入容器时,/ opt / evdc-venv / require.txt中的requirements.txt文件不包含新包。 有什么办法可以删除这个缓存版本的requirements.txt吗?

  • 开发操作系统:Windows 10
  • Docker:17.03.0-ce
  • docker-compose:1.11.2

1 个答案:

答案 0 :(得分:1)

docker-compose up除非您使用Dockerfile定义了build部分并且将--build参数传递给它,否则不会构建新图像。没有它,它将重用现有的图像。

如果您的docker-compose.yml不包含构建部分,并使用docker build ...构建图像,则在重新创建图像后,docker-compose up将重新创建受影响的容器。