简体   繁体   English

如何将docker-machine设置为默认值?

[英]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. 我想从名为default Docker VM重建所有内容,我使用了docker-compose down但是它只删除了容器,所有要求仍然安装,我希望它从一开始就保持原状,所以我可以-设置所有内容。 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. 如果您使用的是较新版本的docker,请尝试使用docker system prune -a命令。

But maybe the --no-cache argumant ist the real solution for your problem. 但也许--no-cache argistant可以为您的问题提供真正的解决方案。 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)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM