dockerfile没有改变,只是workdir所对应的容器外部的文件发生了改变
请问这是必须的么,如果是这样的话,是要用docker compose-up 自动简化这个过程?
如果不是必须的话,因为我的dockerfile的问题么?
dockerfile如下:FROM ubuntuMAINTAINER Tarty.Phoenix <tartyphoenix@gmail.com>RUN apt-get updateRUN apt-get install -y -q python-all python-pip libffi-devRUN apt-get install -y -q python-dev build-essentialADD ./flask_pure/requirements.txt /tmp/requirements.txtRUN pip install -qr /tmp/requirements.txtADD ./flask_pure /opt/flask_pure/WORKDIR /opt/flask_pureEXPOSE 80CMD ["python", "manage.py", "runserver"]
解决方案
首先 workdir 代表的目录是容器里面的目录,不是 host 的。
下面的内容变化需要重新 build image
dockerfile 本身变化
COPY / ADD 指令的 source 文件变化
docker-compose 支持运行的时候重新 build image 的
service: - build: <image_base_dir>