I made some updates on a Dockerfile for one of the services, but the changes are not reflecting, when running docker-compose build
, not even with --no-cache
option.
I added two two parameter before running pip install -f requirements.txt
, but they are not executed at any time: it goes directly to the requirements step.
$ docker-compose build --no-cache mongo uses an image, skipping postgres uses an image, skipping elasticsearch uses an image, skipping Building nucleo Step 1/9 : FROM python:3.6 ---> 2bb3204ab1d1 Step 2/9 : COPY core/ /container_core/ ---> cc1eadcb80a3 Step 3/9 : WORKDIR /container_core ---> Running in e8afa25b9c9a Removing intermediate container e8afa25b9c9a ---> f9b928dee6f5 Step 4/9 : RUN pip install -r requirements.txt ---> Running in 84f474edb526 ^CERROR: Aborting.
docker-compose.yml
services: mongo: image: "mongo:4.0.5" container_name: compose_mongo restart: always environment: - MONGO_INITDB_ROOT_USERNAME=mongo - MONGO_INITDB_ROOT_PASSWORD=mongopass ports: - "27017:27017" core: build: context: /home/ivanleoncz/git/core dockerfile: Dockerfile container_name: compose_core depends_on: - mongo env_file: - .env ports: - "8000:8000"
Dockerfile
FROM python:3.6 COPY core/ /container_core/ WORKDIR /container_core # must run before requirements RUN pip install --upgrade pip RUN pip install urllib3=1.20 # then, run the requirements RUN pip install -r requirements.txt CMD ["python3", "manage.py", "makemigrations", "app1"] CMD ["python3", "manage.py", "makemigrations", "app2"] CMD ["python3", "manage.py", "makemigrations", "app3"] CMD ["python3", "manage.py", "migrate"] CMD ["python3", "manage.py", "runserver"]
I'm using docker-compose 1.21.2, with Ubuntu 18.04.2.
How can I guarantee that docker-compose
is not using an old version of my Dockerfile, even though I'm describing that I want to perform the build, without any cache (--no-cache
)?