-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-cmds.sh
More file actions
69 lines (58 loc) · 1.66 KB
/
Copy pathdocker-cmds.sh
File metadata and controls
69 lines (58 loc) · 1.66 KB
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
# list ips for all running containers
alias dps="docker ps -q | xargs docker inspect --format '{{ .Id }} - \
{{ .Name }} - {{ .NetworkSettings.IPAddress }}'"
# list dangling volume containers
alias lsdvol="docker volume ls -qf dangling=true"
# remove dangling volume containers
alias rmdvol="docker volume rm $(docker volume ls -qf dangling=true)"
# list all containers
alias lsdkr="docker ps -a -q"
# stop all containers
alias stpdkr="docker stop $(docker ps -a -q)"
# remove all containers
alias rmdkr="docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)"
# build new image
function buildcd(){
if [ ! -f ./Dockerfile ]; then
echo "Dockerfile not found in your current directory"
else
docker build -t "${PWD##*/}" .
fi
}
# tag an image
function dtag(){
if [ ! -f ./Dockerfile ]; then
echo "Dockerfile not found in your current directory"
else
docker tag "${PWD##*/}" $DOCKER_REG_DIR/"${PWD##*/}"
fi
}
# upload an image
function dpush(){
if [ ! -f ./Dockerfile ]; then
echo "Dockerfile not found in your current directory"
else
docker push $DOCKER_REG_DIR/"${PWD##*/}"
fi
}
function builddev(){
if [ ! -f ./Dockerfile.dev ]; then
echo "Dockerfile.dev not found in your current directory"
else
docker build -t "${PWD##*/}":dev -f Dockerfile.dev .
fi
}
function dtagdev(){
if [ ! -f ./Dockerfile ]; then
echo "Dockerfile.dev not found in your current directory"
else
docker tag "${PWD##*/}":dev $DOCKER_REG_DIR/"${PWD##*/}":dev
fi
}
function dpushdev(){
if [ ! -f ./Dockerfile ]; then
echo "Dockerfile.dev not found in your current directory"
else
docker push $DOCKER_REG_DIR/"${PWD##*/}":dev
fi
}