[docker]

Here are some docker commands I often used.

Remove all stopped containers
1
docker rm `docker ps --no-trunc -aq`
Remove all untagged images
1
docker rmi -f $(sudo docker images -q --filter "dangling=true")
Remove all containers and images
1
docker ps -q |xargs docker rm; docker images -q |xargs docker rmi
Clean docker volume
1
docker volume ls -qf dangling=true | xargs -r docker volume rm
Docker in docker
1
docker run --privileged -v /var/run/docker.sock:/var/run/docker.sock -it docker:dind commands
Setup remote docker-engine via docker-machine
1
2
docker-machine create --driver generic --generic-ip-address=192.168.1.2 --generic-ssh-key=/Users/taka/.ssh/id_rsa --generic-ssh-user=taka --engine-storage-driver=overlay arm
eval $(docker-machine env arm)