Skip to content

Instantly share code, notes, and snippets.

@garukun
Last active February 20, 2016 06:15
Show Gist options
  • Save garukun/6ac0fe4570037d4cf3ef to your computer and use it in GitHub Desktop.
Save garukun/6ac0fe4570037d4cf3ef to your computer and use it in GitHub Desktop.
Bash script for Docker related commands
#!/bin/bash
# Docker Machine
# dmls lists all available Docker machines.
dmls() {
docker-machine ls
}
# dmclean cleans all Docker containers, dangling imeages, and dangling volumes.
dmclean() {
docker rm $(docker stop $(docker ps -aq))
docker rmi $(docker images -f dangling=true -q)
docker volume rm $(docker volume ls -qf dangling=true)
}
# Docker
# dkinit initializes the docker shell to point to a given docker machine. If
# not supplied, a default machine is provided.
dkinit() {
machine=$@
if [[ -z $machine ]]; then
machine="jaeger-dev"
fi
eval "$(docker-machine env $machine)"
}
# Docker Compose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment