I have a yml file for docker compose to create two containers and connect them. I made some changes to the code today(replaced a folder to be added in one of the docker files).Here's the yml file:
version: '3'
services:
web:
build: ./web
ports:
- "8000:8000"
restart: always
volumes:
- web:/www
nginx:
build: ./nginx
ports:
- "80:80"
restart: always
links:
- web
volumes:
- web:/www
volumes:
web:
The change I made was to the dockerfile in ./web:
FROM python:3.6.4
RUN mkdir /www
WORKDIR /www
ADD . /www/
RUN pip install -r requirements.txt
EXPOSE 8000
CMD python /www/davidbien/manage.py migrate
CMD cd dockertest && gunicorn dockertest.wsgi:application -w 2 -b :8000
The change I made was to change the /davidbien/ folder name from dockertest folder.
I tried rebuilding images by running:
docker-compose build --no-cache
But this did not help. I also tried the same command without --no-cache. I also tried :
docker-compose up --force-recreate
After rebuilding but when I run the script I don't know why the old folder still appears(even though it's removed). What else can I do to clear the cache in docker-compose? I googled that but only got the above two commands. Thanks
Docker Compose has a built-in pull command that will pull updated versions of all the images in your stack.
By pushing a new Docker image to your repository, Watchtower will automatically trigger a chain of events to update your running container's base Docker image. When Watchtower detects a new push, it will pull the new base image, gracefully shutdown your running container, and start it back up.
I had the same issue and the quickest way I manage to solve this and get my containers updated is by changing their names.
So, I had a container named app
and it's settings in app.docker
. I renamed this to php
and php.docker
respectively. Running docker-composer up -d
created the updated containers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With