Skip to content

Instantly share code, notes, and snippets.

@e-belair
Forked from jgrodziski/docker-aliases.sh
Last active May 8, 2020 08:43
Show Gist options
  • Save e-belair/42c6c81c969b51be3f6f14a6ddfb6efb to your computer and use it in GitHub Desktop.
Save e-belair/42c6c81c969b51be3f6f14a6ddfb6efb to your computer and use it in GitHub Desktop.
Useful Docker Aliases
export LANG="en_US.UTF-8"
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="jgrodziski"
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"
# Uncomment this to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"
# Uncomment to change how often before auto-updates occur? (in days)
# export UPDATE_ZSH_DAYS=13
# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment following line if you want to disable command autocorrection
# DISABLE_CORRECTION="true"
# Uncomment following line if you want red dots to be displayed while waiting for completion
# COMPLETION_WAITING_DOTS="true"
# Uncomment following line if you want to disable marking untracked files under
# VCS as dirty. This makes repository status check for large repositories much,
# much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
[[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`
plugins=(git docker osx sublime mvn ssh-agent lein brew dircycle history jump z autojump zsh-syntax-highlighting)
source $ZSH/oh-my-zsh.sh
# Customize to your needs...
setopt auto_cd
cdpath=(~/Dropbox/projects/deepencity/product/backend ~/Dropbox/projects ~/Dropbox/projects/deepencity ~/Dropbox/projects/zenmodeler ~/Google\ Drive/ ~/Dropbox/projects/zm-websites/ ~/Dropbox/projects/deepencity/product ~/Dropbox/projects/deolan ~/Dropbox/projects/prez)
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH
export PATH=$PATH:~/Dropbox/projects/deepencity/product/backend/javaByteCodeAnalyzer
export PATH=$PATH:~/Dropbox/projects/deepencity/product/core/city
export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
export MONGO_HOME=/usr/local/Cellar/mongodb/3.0.7
export NEO4J_HOME=/usr/local/cellar/neo4j/2.3.1
export RABBITMQ_HOME=/usr/local/cellar/rabbitmq/3.4.2
export M2_HOME=/usr/local/Cellar/maven/3.3.9/libexec/
export GROOVY_HOME=/usr/local/opt/groovy/libexec
export DATOMIC_HOME=/Users/jeremiegrodziski/datomic-pro-0.9.5067/
export DATOMIC_CONSOLE_HOME=/Users/jeremiegrodziski/datomic-console-0.1.199/
export SONAR_RUNNER_HOME=/usr/local/Cellar/sonar-runner/2.4/libexec
#export LEIN_JAVA_CMD=/usr/local/Cellar/drip/2.2.4/bin/drip
export LEIN_FAST_TRAMPOLINE=y
export PATH="$HOME/.node/bin:$PATH"
alias vi=vim
alias t=todo.sh
alias sbr="mvn spring-boot:run"
alias jks="jekyll serve"
#envfile="$HOME/.gnupg/gpg-agent.env"
#if [[ -e "$envfile" ]] && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then
# eval "$(cat "$envfile")"
#else
# eval "$(gpg-agent --daemon --enable-ssh-support --write-env-file "$envfile")"
#fi
#export GPG_AGENT_INFO # the env file does not contain the export statement
#export SSH_AUTH_SOCK # enable gpg-agent for ssh
archey -c
export GOPATH=$HOME/go
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
############################################################################
# #
# ------- Useful Docker Aliases -------- #
# #
# # Installation : #
# copy/paste these lines into your .bashrc or .zshrc file #
# #
# # Usage: #
# #
# dex <container>: execute a bash shell inside the running <container> #
# di <container> : docker inspect <container> #
# dim : docker images #
# dipall : IP addresses of all running containers #
# dnames : names of all running containers #
# dps : docker ps #
# dpsa : docker ps -a #
# #
############################################################################
function dnames-fn {
for ID in `docker ps | awk '{print $1}' | grep -v 'CONTAINER'`
do
docker inspect $ID | grep Name | head -1 | awk '{print $2}' | sed 's/,//g' | sed 's%/%%g' | sed 's/"//g'
done
}
function dipall-fn {
echo "IP addresses of all named running containers"
for DOC in `dnames-fn`
do
IP=`docker inspect $DOC | grep -m3 IPAddress | cut -d '"' -f 4 | tr -d "\n"`
echo $DOC : $IP
done
}
function dex-fn {
docker exec -it $1 /bin/bash
}
function di-fn {
docker inspect $1
}
alias dex=dex-fn
alias di=di-fn
alias dim="docker images"
alias dipall=dipall-fn
alias dnames=dnames-fn
alias dps="docker ps"
alias dpsa="docker ps -a"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment