-
Notifications
You must be signed in to change notification settings - Fork 37
/
.bashrc
83 lines (68 loc) · 2.25 KB
/
.bashrc
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
82
83
##################################################################
# run 'source ~/.bashrc' to load latest changes in current session
# ALIASES ########################################################
# Note that these aliases do not work on Synology docker, due to the fact that they are a number of versions behind. (c>
# Set docker aliases
alias dive='docker run -ti --rm -v /var/run/docker.sock:/var/run/docker.sock wagoodman/dive'
alias cdkr='cd ~/docker'
alias cdcd='cd ~/code/dockerholics/compose-examples'
alias list='docker ps -a --format "table {{.Names}}\t{{.ID}}\t{{.Status}}" | (read -r; printf "%s\n" "$REPLY"; sort -k >
alias down='docker compose down -v'
alias pull='docker compose pull'
alias up='docker compose up -d'
alias inspect='docker inspect'
alias create='docker compose up --no-start'
alias stop='docker stop'
alias startall='docker start $(docker ps -a -q)'
alias stopall='docker stop $(docker ps -a -q)'
alias start='docker start'
alias prune='docker system prune -a --volumes'
alias del='docker rm'
alias logs='docker logs -f'
alias ddf='docker system df'
# Set other aliases
alias ver='cat /etc/os-release && uname -mrs && docker -v && docker compose version'
alias osupgrade='sudo do-release-upgrade'
alias upgrade='sudo apt-get update && sudo apt-get upgrade -y && sudo apt autoremove --purge -y'
alias topsize='sudo du -Sha | sort -rh | head -n 10'
# FUNCTIONS ####################################################
# run a command inside a given container
drun() {
docker exec $1 $2
}
# Restarts a container
#
cycle() {
docker restart $1
}
# pulls a image and then creates and starts it
pullup() {
pull $1
up $1
}
# Opens a bash shell, given a supplied container name
#
termb() {
docker exec -it $1 /bin/bash
}
# Opens a ash shell, given a supplied container name
#
terma() {
docker exec -it $1 /bin/ash
}
# stops and deletes a container
#
std() {
stop $1
del $1
}
# Shows 'port in use' details for a supplied port number
#
piu() {
sudo netstat -plan | grep ":$1"
}
# ENVIRONMENT SETTINGS ##########################################
#
# Helps avoid timeouts for large yaml scripts
export DOCKER_CLIENT_TIMEOUT=360
export COMPOSE_HTTP_TIMEOUT=360