Horai Nuri
Horai Nuri

Reputation: 5578

How to setup docker-machine to be as default?

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 ?

Upvotes: 2

Views: 415

Answers (2)

Robert
Robert

Reputation: 36823

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)

Upvotes: 1

Julian
Julian

Reputation: 2822

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.

Upvotes: 3

Related Questions