Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker 常用知识总结 #17

Open
victoryw opened this issue May 11, 2017 · 0 comments
Open

docker 常用知识总结 #17

victoryw opened this issue May 11, 2017 · 0 comments
Milestone

Comments

@victoryw
Copy link
Owner

victoryw commented May 11, 2017

docker 部署体系介绍

镜像、容器、服务、栈、分布式部署等等
https://docs.docker.com/get-started/part2/

docker rm container, images and Volumes, especially dangling

https://www.digitalocean.com/community/tutorials/how-to-remove-docker-images-containers-and-volumes

docker rm contaner

docker rm exited container

$ docker ps -a -f status=exited
$ docker rm $(docker ps -a -f status=exited -q)

if more than one filter

$ docker ps -a -f status=exited -f status=created
$ docker rm $(docker ps -a -f status=exited -f status=created -q)

docker rm by grep

$ docker ps -a |  grep "pattern”
$ docker ps -a | grep "pattern" | awk '{print $3}' | xargs docker rmi

Stop and remove all containers

$ docker stop $(docker ps -a -q)
$ docker rm $(docker ps -a -q

Removing Volumes

$ docker volume rm $(docker volume ls -f dangling=true -q)

$ docker volume ls
$ docker volume rm volume_name volume_name

docker移除无用image

docker images -q --filter "dangling=true" | xargs -t --no-run-if-empty docker rmi

https://docs.docker.com/compose/reference/down/

docker composer 的 health check

docker for mac 空间回收

from docker/for-mac#371

brew install  qemu
$ pwd
/Users/nick/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux
$ mv Docker.qcow2 Docker.qcow2.original
$ du -hs Docker.qcow2.original
12G     Docker.qcow2.original
$ qemu-img convert -O qcow2 Docker.qcow2.original Docker.qcow2
$ rm Docker.qcow2.original
$ du -hs Docker.qcow2

772M Docker.qcow2

@victoryw victoryw added this to the 2017-5-8-learn milestone May 11, 2017
@victoryw victoryw changed the title docker rm container, images and Volumes, especially dangling docker 常用知识总结 May 16, 2017
@victoryw victoryw reopened this May 16, 2017
@victoryw victoryw added this to the 2017-6-25 milestone Jun 15, 2017
@victoryw victoryw modified the milestones: 2017-6-25, 2016-7-9 Jun 26, 2017
@victoryw victoryw modified the milestones: 2016-7-9, 2017-07-22 Jul 15, 2017
@victoryw victoryw modified the milestones: 2017-07-22, 2017-08-12 Jul 31, 2017
@victoryw victoryw modified the milestones: 2017-08-12, 2017-8-27 Aug 15, 2017
@victoryw victoryw modified the milestones: 2017-08-27, 2017-09-16 Sep 3, 2017
@victoryw victoryw modified the milestones: 2017-09-16, 2017-08-27 Sep 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant