-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker.bash
More file actions
39 lines (30 loc) · 835 Bytes
/
docker.bash
File metadata and controls
39 lines (30 loc) · 835 Bytes
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
#!/bin/bash
alias d="docker"
# Prune environemnt
alias dprune="docker system prune -af --volumes"
alias dprunevolumes="docker volume prune"
# System
alias dsize="docker system df"
alias dclearContainers="docker rmi $(docker images -f "dangling=true" -q)"
alias dclearVolumes="docker volume rm $(docker volume ls -qf dangling=true)"
# Shortcuts
alias di="d images"
alias dp="d ps"
alias dv="d volume"
alias dn="d network"
alias dt="d tag"
alias dr="d run --rm -it"
alias dtag="tagDockerImage"
alias de="dockerExecuteIteration"
# Tools
alias dip="d inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'"
function dockerExecuteIteration() {
docker exec -it $1 bash
}
function tagDockerImage() {
CONTAINER="$1"
REPOSITORY="$2"
TAG="$3"
docker tag "$CONTAINER" "$REPOSITORY/$TAG"
}
alias lzd="lazydocker"