-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathSetup-Docker.psm1
70 lines (54 loc) · 1.29 KB
/
Setup-Docker.psm1
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
function dbash {
Param(
[parameter(Mandatory=$true)][string]$container
)
docker exec -it $container /bin/bash
}
# Get latest container ID
function dl {
docker ps -l -q $args
}
# Get container process
function dps {
docker ps --format="table {{.Names}}\t{{.ID}}\t{{.Image}}\t{{.RunningFor}}\t{{.State}}\t{{.Status}}"
}
function dpsp {
docker ps --format="table {{.Names}}\t{{.ID}}\t{{.Image}}\t{{.RunningFor}}\t{{.State}}\t{{.Status}}\t{{.Ports}}"
}
# Get process included stop container
function dpa {
docker ps -a $args
}
function db {
docker build -t $arg .
}
# Get images
function di {
docker images $args
}
# Get container IP
function dip {
docker inspect --format '{{ .NetworkSettings.IPAddress }}' $args
}
# Run deamonized container, e.g., $dkd base /bin/echo hello
function dkd {
docker run -d -P $args
}
# Run interactive container, e.g., $dki base /bin/bash
function dki {
docker run --rm -i -t -P $args /bin/bash
}
# Execute interactive container, e.g., $dex base /bin/bash
function dex {
docker exec -it $args
}
# delete all non running containers
function drm {
docker rm $(docker ps -q -a)
}
# delete all images that are not in use
function dri {
docker rmi $(docker images -q)
}
Set-Alias dc "docker compose"
Export-ModuleMember -Function * -Alias *