-
Notifications
You must be signed in to change notification settings - Fork 47
/
podman_inspect.sh
executable file
·149 lines (118 loc) · 3.11 KB
/
podman_inspect.sh
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/usr/bin/env sh
# podman_inspect.sh demo script.
# This script will demonstrate at an introductory level
# the use of the podman inspect command.
# Podman must be installed prior to running this script.
# Setting up some colors for helping read the demo output.
# Comment out any of the below to turn off that color.
bold=$(tput bold)
cyan=$(tput setaf 6)
reset=$(tput sgr0)
read_color() {
read -p "${bold}$1${reset}"
}
echo_color() {
echo "${cyan}$1${reset}"
}
setup() {
command -v podman >/dev/null
if [ $? != 0 ]; then
echo $0 requires the podman package to be installed
exit 1
fi
clear
}
intro() {
echo_color "\`podman inspect\` Demo"
echo
echo_color "Available at https://github.com/containers/Demos/podman_cli/podman_inspect.sh"
echo
}
version() {
echo_color "First check the Podman version"
echo
read_color "podman version"
echo
podman version
echo
echo
read -p "Enter to continue"
clear
}
podman_pull_images() {
echo_color "Let's pull our container image"
echo
read_color "podman pull alpine"
podman pull alpine
echo
echo_color "Let's look at the image"
echo
read_color "podman images"
podman images
echo
read -p "Enter to continue"
clear
}
podman_inspect() {
echo
echo_color "Let's look at what the inspect command can do"
echo
echo_color "Inspect the alpine image"
echo
read_color "podman inspect -t image alpine | less"
podman inspect -t image alpine | less
echo
echo_color "Let's create a container to inspect"
echo
read_color "podman run --name=myctr alpine ls /etc/network"
podman run --name=myctr alpine ls /etc/network
echo
echo_color "Now inspect our container"
echo
read_color "podman inspect -t container myctr | less"
podman inspect -t container myctr | less
echo
echo_color "Inspect our latest container"
echo
read_color "podman inspect --latest | less"
podman inspect --latest | less
echo
echo_color "Look at the containers ImageName"
echo
read_color "podman inspect -t container --format \"imagename: {{.ImageName}}\" myctr"
podman inspect -t container --format "imagename: {{.ImageName}}" myctr
echo
echo_color "Look at the containers GraphDriver.Name"
echo
read_color "podman inspect -t container --format \"table {{.GraphDriver.Name}}\" myctr"
podman inspect -t container --format "graphdriver: {{.GraphDriver.Name}}" myctr
echo
echo_color "Look at the image size using format"
echo
read_color "podman inspect -t image --format \"size: {{.Size}}\" alpine"
podman inspect -t image --format "size: {{.Size}}" alpine
echo
read -p "Enter to continue"
clear
}
clean_images_and_containers() {
echo
echo_color "Time to clean up!"
read_color "podman rm -a -f"
podman rm -a -f
echo
read_color "podman rmi -a -f"
podman rmi -a -f
echo
read -p "Enter to continue"
clear
}
setup
intro
version
podman_pull_images
podman_inspect
clean_images_and_containers
read -p "End of Demo!!!"
echo
echo "Thank you!"