Last active
August 29, 2015 14:05
-
-
Save techniq/da873605e6ea8e40dcc5 to your computer and use it in GitHub Desktop.
Docker Helpers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get the last container ID | |
alias docker-last="docker ps -l" | |
# Get a container's IP | |
alias docker-get-ip="docker inspect --format '{{ .NetworkSettings.IPAddress }}'" | |
# Get a container's image | |
alias docker-get-image="docker inspect --format '{{ .Image }}'" | |
# Remove all exited docker containers | |
docker-rm-all() { docker rm $(docker ps -aq); } | |
# Remove all untagged docker images | |
docker-rm-untagged-images() { docker rmi `docker images | awk '{if ($2 == "<none>") print $3}' | xargs`; } | |
#clean up all docker containers and untagged images | |
docker-clean() { docker-rm-all; docker-rm-untagged-images; } | |
# Shorthand for docker build | |
db() { docker build -t="$1" .; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add aliases to shell. Run `. ./setup-shell.sh` (not the leading `.` and space) | |
alias ansible='docker run -v "$(pwd):/app" -w "/app" -it --rm ansible/ubuntu14.04-ansible ansible --private-key=.ssh/id_rsa' | |
alias ansible-playbook='docker run -v "$(pwd):/app" -w "/app" -it --rm ansible/ubuntu14.04-ansible ansible-playbook --private-key=.ssh/id_rsa' | |
alias ansible-shell='docker run -v "$(pwd):/app" -w "/app" -it --rm ansible/ubuntu14.04-ansible bash' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment