-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerrc
32 lines (31 loc) · 1.05 KB
/
dockerrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Get latest container ID
alias dl="docker ps -l -q"
# Get container process
alias dps="docker ps"
# Get process included stop container
alias dpa="docker ps -a"
# Get images
alias di="docker images"
# Get container IP
alias dip="docker inspect --format '{{ .NetworkSettings.IPAddress }}'"
# Run daemonized container, e.g., $dkd base /bin/echo hello
alias dkd="docker run -d -it --net=host"
# Run interactive container, e.g., $dki base /bin/bash
alias dkr="docker run -it --net=host"
# Execute interactive container, e.g., $dex base /bin/bash
alias dex="docker exec -it"
# Remove containers
alias drm="docker rm -v"
# Docker VM start and env
alias dmct="docker-machine create --driver virtualbox"
alias dmst="docker-machine start"
alias dmrm="docker-machine rm"
alias dmrs="docker-machine restart"
alias dmenv="docker-machine env"
alias dmls="docker-machine ls"
dmsetup() {
dmct $1
eval "$(dmenv $1)"
}
dockermachine=$(docker-machine ls | grep Running | head -n 1 | awk '{print $1}')
if [[ ! -z "$dockermachine" ]]; then eval "$(docker-machine env $dockermachine)"; fi