1
- # nano ~/.bashrc
2
- # run 'source ~/.bashrc' to load latest changes in current session
3
-
4
- # ALIASES #####################################################
5
- # 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)
1
+ # #################################################################
6
2
3
+ # run 'source ~/.bashrc' to load latest changes in current session
7
4
8
- # ######### Set docker aliases
9
- #
5
+ # ALIASES ########################################################
6
+ # Note that these aliases do not work on Synology docker, due to the fact that they are a number of versions behind. (c>
10
7
11
- # basic change folder command
12
- alias cdkr=' cd ~/docker'
8
+ # Set docker aliases
9
+ alias dive=' docker run -ti --rm -v /var/run/docker.sock:/var/run/docker.sock wagoodman/dive'
10
+ alias cdkr=' cd ~/docker'
13
11
alias cdcd=' cd ~/code/dockerholics/compose-examples'
14
-
15
- # list all containers in a formatted list
16
- alias list=' docker ps -a --format "table {{.Names}}\t{{.ID}}\t{{.Image}}\t{{.Status}}" | (read -r; printf "%s\n" "$REPLY"; sort -k 1 )'
17
-
18
- # stop and remove all containers in your compose file. Optional to add a single container name
12
+ alias list=' docker ps -a --format "table {{.Names}}\t{{.ID}}\t{{.Status}}" | (read -r; printf "%s\n" "$REPLY"; sort -k >
19
13
alias down=' docker compose down -v'
20
-
21
- # pull latest images in your compose file. Optional to add a single container name
22
14
alias pull=' docker compose pull'
23
-
24
- # start all containers in your compose file. Optional to add a single container name
25
15
alias up=' docker compose up -d'
26
-
27
- # inspect the details for a given container
28
16
alias inspect=' docker inspect'
29
-
30
- # create, but dont start, all containers in your compose file. Optional to add a single container name
31
17
alias create=' docker compose up --no-start'
32
-
33
- # stop a specific container
34
18
alias stop=' docker stop'
35
-
36
- # stop all containers
37
- alias stopall=' docker stop $(docker ps -a -q)'
38
-
39
- # start all containers
40
19
alias startall=' docker start $( docker ps -a -q) '
41
-
42
- # start a specific container
20
+ alias stopall=' docker stop $( docker ps -a -q) '
43
21
alias start=' docker start'
44
-
45
- # Remove all images and volumes that are not in use. *including stopped containers*
46
22
alias prune=' docker system prune -a --volumes'
47
-
48
- # delete a stopped container
49
23
alias del=' docker rm'
50
-
51
- # restart a container
52
- alias cycle=' docker restart'
53
-
54
- # show the logs for a specific container
55
24
alias logs=' docker logs -f'
56
-
57
- # show host disk use for docker
58
25
alias ddf=' docker system df'
59
26
60
- # rename a specified container
61
- alias rename=' docker rename'
27
+ # Set other aliases
28
+ alias ver=' cat /etc/os-release && uname -mrs && docker -v && docker compose version'
29
+ alias osupgrade=' sudo do-release-upgrade'
30
+ alias upgrade=' sudo apt-get update && sudo apt-get upgrade -y && sudo apt autoremove --purge -y'
31
+ alias topsize=' sudo du -Sha | sort -rh | head -n 10'
32
+
33
+
62
34
63
35
# FUNCTIONS ####################################################
64
- #
65
36
66
- # run a command inside a given container. Pass a single command or encapsulate in "" for a command with a parameter
37
+ # run a command inside a given container
67
38
drun() {
68
- docker exec $1
39
+ docker exec $1 $2
40
+ }
41
+
42
+ # Restarts a container
43
+ #
44
+ cycle() {
45
+ docker restart $1
69
46
}
70
47
71
48
# pulls a image and then creates and starts it
@@ -99,10 +76,8 @@ piu() {
99
76
sudo netstat -plan | grep ":$1"
100
77
}
101
78
102
-
103
-
104
79
# ENVIRONMENT SETTINGS ##########################################
80
+ #
105
81
# Helps avoid timeouts for large yaml scripts
106
-
107
82
export DOCKER_CLIENT_TIMEOUT=360
108
- export COMPOSE_HTTP_TIMEOUT=360
83
+ export COMPOSE_HTTP_TIMEOUT=360
0 commit comments