-
Notifications
You must be signed in to change notification settings - Fork 37
/
.bashrc-syno
107 lines (76 loc) · 2.68 KB
/
.bashrc-syno
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# nano ~/.bashrc
# 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. (change "docker compose" to "docker-compose" and then it should work)
########## Set docker aliases
# Synology version
# basic change folder command
alias cdkr='cd /volume1/docker'
# list all containers in a formatted list
alias list='docker ps -a --format "table {{.Names}}\t{{.ID}}\t{{.Image}}\t{{.Status}}" | (read -r; printf "%s\n" "$REPLY"; sort -k 1 )'
# stop and remove all containers in your compose file. Optional to add a single container name
alias down='docker-compose down -v'
# pull latest images in your compose file. Optional to add a single container name
alias pull='docker-compose pull'
# start all containers in your compose file. Optional to add a single container name
alias up='docker-compose up -d'
# inspect the details for a given container
alias inspect='docker inspect'
# create, but dont start, all containers in your compose file. Optional to add a single container name
alias create='docker-compose up --no-start'
# stop a specific container
alias stop='docker stop'
# stop all containers
alias stopall='docker stop $(docker ps -a -q)'
# start all containers
alias startall='docker start $(docker ps -a -q)'
# start a specific container
alias start='docker start'
# Remove all images and volumes that are not in use. *including stopped containers*
alias prune='docker system prune -a --volumes'
# delete a stopped container
alias del='docker rm'
# restart a container
alias cycle='docker restart'
# show the logs for a specific container
alias logs='docker logs -f'
# show host disk use for docker
alias ddf='docker system df'
# rename a specified container
alias rename='docker rename'
# FUNCTIONS ####################################################
#
# run a command inside a given container. Pass a single command or encapsulate in "" for a command with a parameter
drun() {
docker exec $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