docker-compose keeps using old image content

According to the documentation, you can ignore data from previous volume with this:

docker-compose up -d --force-recreate --renew-anon-volumes

See https://docs.docker.com/compose/reference/up/


The process should be:

docker-compose pull
docker-compose up

If you have volumes, then those will be persistent by design. If you need your volumes to not be persistent, then you may want to reconsider having that data inside a volume, or you'll need to reset the volume on every redeploy with a docker-compose down -v to remove the containers and the volumes.

If you still have issues with this, make sure your install of docker and docker-compose are current.


I just had this problem in dev too. docker-compose up uses an old image even though I have built the latest image. And if I manually run docker run in latest image I can see the new changes. What fixed for me is running:

docker-compose up --build <your-service>.

Hope it helps!