I want to rebuild everything from my docker VM named default
, I used docker-compose down
but it only removed the containers, all the requirements are still installed and I would like it to be as it was from the beginning so I can 're'-setup everything. Is it possible ?
This will remove all containers, images and volumes
docker rm -f $(docker ps -aq)
docker image rm $(docker image ls -q)
docker volume rm $(docker volume ls -q)
There are other things like networks and secrets that will not be removed, but they should not cause any problems.
If you are using a newer version of docker try the docker system prune -a
command instead.
But maybe the --no-cache
argumant ist the real solution for your problem. With it, docker will not use the cache and will do a full rebuild of the image.
The simple solution that will ignore previous builds:
docker-compose build --no-cache
But if you want something more destructive:
docker-machine rm default
docker-machine create default
eval $(docker-machine env default)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.