blob: 148231d388dd174055d516d9a96ee18bd6728d6a (
plain)
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
|
#!/bin/sh
# container-tools - Manage systemd-nspawn containers
# Copyright (C) 2014-2016 Daniel Baumann <daniel.baumann@open-infrastructure.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -e
# Usage: sudo asciinema -c ./introduction.sh
PS1="root@debian:~#"
Command ()
{
COMMAND="${@}"
echo
echo -n "${PS1} "
echo "${COMMAND}"
${COMMAND}
echo "${PS1}"
echo
sleep 2
}
Text ()
{
TEXT="${@}"
echo "${TEXT}"
sleep 2
}
# Content
sleep 2
Text "# Welcome to this container-tools introduction cast."
echo
echo
Text "# 1. We're using Debian ($(lsb_release -cs))..."
Command "lsb_release -a"
Text "# ...and container-tools version $(cnt version)."
Command "cnt version"
Text "# 2. Let's list all available containers."
Text "#"
Text "# Note: there are no containers yet."
Command "sudo cnt list"
Text "# 3. Let's create an example container."
Text "#"
Text "# Note: creating containers with the simple debootstrap"
Text "# container create script is slow as it doesn't cache anything."
Text "# Using the advanced debconf container create script for"
Text "# fast, automated, and reproducible setup of complex containers"
Text "# will be covered in a subsequent screencast."
Text "#"
Text "# Note: we're using a custom mirror here and"
Text "# a custom root password, see container-create-debootstrap(1)"
Text "# for more information about these options."
Command "sudo cnt create -n example.net -s debootstrap -- -d sid -m http://ftp.ch.debian.org/debian -p debian"
Text "# 4. Let's list all available containers."
Text "#"
Text "# Note: there's one container now."
Command "sudo cnt list"
Text "# 5. Let's start the example container."
Command "sudo cnt start -n example.net"
Text "# 6. Let's check if the container was started."
Command "sudo cnt list"
Text "# 7. Let's stop the example container."
Command "sudo cnt stop -n example.net"
Text "# 8. Let's check if the container was stopped."
Command "sudo cnt list"
Text "# 9. Let's remove the example container."
Command "sudo cnt remove -f -n example.net"
Text "# 10. Let's check if the container was removed."
Command "sudo cnt list"
echo
echo
Text "# This concludes this introduction to container-tools."
Text "#"
Text "# Thanks for watching and have fun setting up"
Text "# your own Linux containers based on systemd-nspawn"
Text "# using container-tools from Open Infrastructure:"
Text "#"
Text "# https://open-infrastructure.net/software/container-tools"
sleep 2
exit 0
|