forked from tcnksm/docker-alias
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathzshrc
81 lines (63 loc) · 2.65 KB
/
zshrc
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# ------------------------------------
# Docker alias and function
# ------------------------------------
# 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 deamonized container, e.g., $dkd base /bin/echo hello
alias dkd="docker run -d -P"
# Run interactive container, e.g., $dki base /bin/bash
alias dki="docker run -i -t -P"
# Execute interactive container, e.g., $dex base /bin/bash
alias dex="docker exec -i -t"
# Stop all containers
dstop() { docker stop $(docker ps -a -q); }
# Remove all containers
drm() { docker rm -f $(docker ps -a -q); }
# Remove none docker images
diclean(){ docker rmi $(docker images | grep none | awk '{print $3}'); }
# Stop and Remove all containers
alias drmf='docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)'
# Remove all images
dri() { docker rmi $(docker images -q); }
# Dockerfile build, e.g., $dbu tcnksm/test
dbu() { docker build -t=$1 .; }
# Show all alias related docker
dalias() { alias | grep 'docker' | sed "s/^\([^=]*\)=\(.*\)/\1 => \2/"| sed "s/['|\']//g" | sort; }
# Bash into running container
dbash() { docker exec -it $(docker ps -aqf "name=$1") bash; }
#rsync
myrsync() {
if [ ! -n "$1" ] ;then
echo "please enter a type: "
echo "1.dp-data-system"
echo "2.dp-thrall "
echo "3.debezium "
echo "4.restService "
echo "5.startKit "
else
if [ "$1" = "1" ]
then
rsync -ar --delete --exclude='.git*' --filter=':- .gitignore' /Users/kevin/CloudStation/root/datapipeline/workspace/dp-data-system root@testpub:~/projects
elif [ "$1" = "2" ]
then
rsync -ar --delete --exclude='.git*' --filter=':- .gitignore' /Users/kevin/CloudStation/root/datapipeline/workspace/dp-thrall root@testpub:~/projects
elif [ "$1" = "3" ]
then
rsync -ar --delete --exclude='.git*' --filter=':- .gitignore' /Users/kevin/CloudStation/root/datapipeline/workspace/debezium root@testpub:~/projects
elif [ "$1" = "4" ]
then
rsync -ar --delete --exclude='.git*' --filter=':- .gitignore' /Users/kevin/CloudStation/root/datapipeline/workspace/restService root@testpub:~/projects
else
rsync -ar --delete --exclude='.git*' --filter=':- .gitignore' /Users/kevin/CloudStation/root/datapipeline/workspace/DpStarterKit root@testpub:~/projects
fi
fi
# rsync -ar --delete --exclude='.git*' --filter=':- .gitignore' /Users/kevin/CloudStation/root/datapipeline/workspace/$1 root@testpub:~/projects;
}