-
-
Save ferr0/7a0f3f7c4b1ae8a781cb1b5020f62cf3 to your computer and use it in GitHub Desktop.
docker scripts
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
#!/usr/bin/env bash | |
unalias d | |
alias d=docker | |
alias dm=docker-machine | |
alias fig=docker-compose | |
alias vidocker="$EDITOR $HOME/.oh-my-zsh/custom/docker.zsh" | |
de() { docker exec -it $(docker ps -l -q) ${1:-'/bin/bash'}; } | |
dps() { docker ps --format '{{.ID}}\t{{.Image}}'; } | |
drmc() { docker rm -f $(docker ps -a -q); } | |
drmi() { docker rmi -f $(docker images -q); } | |
drmv() { docker volume rm $(docker volume ls -q); } | |
dstop() { docker stop $(docker ps -a -q); } | |
docker_clean_everything() { drmc; drmi; drmv; } | |
############################################################################### | |
### Docker-Machine | |
############################################################################### | |
dmenv() { | |
if [[ ! $1 ]]; then | |
echo 'No machine name specified.' | |
return 1 | |
fi | |
export DOCKER_TLS_VERIFY="1" | |
export DOCKER_CERT_PATH="${HOME}/.docker/machine/machines/${1}" | |
export DOCKER_MACHINE_NAME="${1}" | |
export DOCKER_HOST="tcp://$(docker-machine ip $1):2376" | |
} | |
dmu() { eval "$(docker-machine env --unset)"; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment