docker clear cache 1

docker clear cache

# Rebuild the image
docker build --no-cache

# Pull the base images again and rebuild
docker build --no-cache --pull

# Also works with docker-compose
docker-compose build --no-cache

# If nothing from the above works for you, you could also prune everything
docker system to prune

Here is what the above code is Doing:
1. docker build –no-cache
This will rebuild the image from scratch, ignoring the cache.
2. docker build –no-cache –pull
This will rebuild the image from scratch, ignoring the cache, and will pull the base images again.
3. docker-compose build –no-cache
This will rebuild the image from scratch, ignoring the cache, and will pull the base images again.
4. docker system to prune
This will remove all unused containers, images, networks, and volumes.

Similar Posts