diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2016-04-21 17:45:15 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2016-05-06 11:59:16 +0000 |
commit | 26ad40b0073a1adfdc512820c9a81eb152428dbb (patch) | |
tree | 107e3cd74211213aae5cf265b8677504711b2991 /share | |
parent | Initial commit. (diff) | |
download | open-infrastructure-compute-tools-26ad40b0073a1adfdc512820c9a81eb152428dbb.tar.xz open-infrastructure-compute-tools-26ad40b0073a1adfdc512820c9a81eb152428dbb.zip |
Adding upstream version 20160301.upstream/20160301
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to '')
-rw-r--r-- | share/config/container.conf.in | 11 | ||||
-rw-r--r-- | share/man/Makefile | 43 | ||||
-rw-r--r-- | share/man/container-console.1.txt | 72 | ||||
-rw-r--r-- | share/man/container-create-debootstrap.1.txt | 93 | ||||
-rw-r--r-- | share/man/container-create.1.txt | 86 | ||||
-rw-r--r-- | share/man/container-list.1.txt | 69 | ||||
-rw-r--r-- | share/man/container-remove.1.txt | 78 | ||||
-rw-r--r-- | share/man/container-restart.1.txt | 72 | ||||
-rw-r--r-- | share/man/container-start.1.txt | 72 | ||||
-rw-r--r-- | share/man/container-stop.1.txt | 78 | ||||
-rw-r--r-- | share/man/container-tools.7.txt | 100 | ||||
-rw-r--r-- | share/man/container-version.1.txt | 69 | ||||
-rw-r--r-- | share/man/container.1.txt | 115 | ||||
-rwxr-xr-x | share/scripts/debootstrap | 135 |
14 files changed, 1093 insertions, 0 deletions
diff --git a/share/config/container.conf.in b/share/config/container.conf.in new file mode 100644 index 0000000..7a0d826 --- /dev/null +++ b/share/config/container.conf.in @@ -0,0 +1,11 @@ +# container-tools: @NAME@ + +[start] +bind=@BIND@ +boot=@BOOT@ +directory=@DIRECTORY@ +machine=@MACHINE@ +network-veth=@NETWORK_VETH@ +network-bridge=@NETWORK_BRIDGE@ +link-journal=@LINK_JOURNAL@ +register=@REGISTER@ diff --git a/share/man/Makefile b/share/man/Makefile new file mode 100644 index 0000000..721c044 --- /dev/null +++ b/share/man/Makefile @@ -0,0 +1,43 @@ +# Makefile + +# Open Infrastructure: container-tools +# 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/>. + +# Depends: asciidoc dblatex docbook-xsl libxml2-utils source-highlight + +A2X = a2x \ + --asciidoc-opts "-a revdate=$(shell cat ../../VERSION.txt)" \ + --doctype=manpage + +SHELL := sh -e + +all: build + +clean: + rm -f *.[0-9] + rm -f *.xml + +build: man + +rebuild: clean build + +man: *.txt + for FILE in *.txt; \ + do \ + $(A2X) --format=manpage $${FILE}; \ + done + +.PHONY: all clean build rebuild man diff --git a/share/man/container-console.1.txt b/share/man/container-console.1.txt new file mode 100644 index 0000000..2ce5353 --- /dev/null +++ b/share/man/container-console.1.txt @@ -0,0 +1,72 @@ +// Open Infrastructure: container-tools +// 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/>. + +CONTAINER-CONSOLE(1) +==================== +:doctype: manpage +:man manual: Open Infrastructure +:man source: container-tools +:man version: {revnumber} + + +NAME +---- +container-console - Attach a console to a container + + +SYNOPSIS +-------- +*container console* ['OPTIONS'] + + +DESCRIPTION +----------- +The container console command attaches a console to a container. + + +OPTIONS +------- +The following container options are available: + +*-n, --name='NAME'*:: + Specify container name. + + +EXAMPLES +-------- +*Attach console to example.net container:*:: + sudo container console -n example.net + + +SEE ALSO +-------- +container-tools(7), +container(1). + + +HOMEPAGE +-------- +More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. + + +BUGS +---- +Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. + + +AUTHORS +------- +container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net>. diff --git a/share/man/container-create-debootstrap.1.txt b/share/man/container-create-debootstrap.1.txt new file mode 100644 index 0000000..1c76711 --- /dev/null +++ b/share/man/container-create-debootstrap.1.txt @@ -0,0 +1,93 @@ +// Open Infrastructure: container-tools +// 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/>. + +CONTAINER-CREATE-DEBOOTSTRAP(1) +=============================== +:doctype: manpage +:man manual: Open Infrastructure +:man source: container-tools +:man version: {revnumber} + + +NAME +---- +container-create-debootstrap - Create a Debian container with debootstrap + + +SYNOPSIS +-------- +*container create -s debootstrap* ['OPTIONS'] + + +DESCRIPTION +----------- +The debootstrap container creation script uses debootstrap(8) to create a Debian container. + +This script creates a pure Debian system with three modificiations: + + * apt cache of packages downloaded during debootstrap is cleaned + * hostname is set (container name) in /etc/hostname + * root password is set (user specified or 16 random characters) + + +OPTIONS +------- +The following script options are available: + +*-n, --name='NAME'*:: + Specify container name. + +*-a, --architecture='ARCHITECTURE'*:: + Specify the Debian architecture, defaults to the host systems architecture. + +*-d, --distribution='DISTRIBUTION'*:: + Specify the Debian distribution, defaults to jessie. + +*-m, --mirror='MIRROR'*:: + Specify the Debian mirror, defaults to http://ftp.debian.org/debian. + +*-p, --root-password='PASSWORD'*:: + Specify the root password, defaults to a random 16 character password. + + +EXAMPLES +-------- +*Create a Debian 8 (jessie) container with same architecture as the host system:*:: + sudo container create -s debootstrap -n jessie.example.net + +*Create a Debian 8 (jessie) with different architecture as the host system:*:: + sudo container create -s debootstrap -n jessie-i386.example.net -- -a i386 + + +SEE ALSO +-------- +container-tools(7), +container(1). + + +HOMEPAGE +-------- +More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. + + +BUGS +---- +Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. + + +AUTHORS +------- +container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net>. diff --git a/share/man/container-create.1.txt b/share/man/container-create.1.txt new file mode 100644 index 0000000..8d9bd06 --- /dev/null +++ b/share/man/container-create.1.txt @@ -0,0 +1,86 @@ +// Open Infrastructure: container-tools +// 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/>. + +CONTAINER-CREATE(1) +=================== +:doctype: manpage +:man manual: Open Infrastructure +:man source: container-tools +:man version: {revnumber} + + +NAME +---- +container-create - Create a container + + +SYNOPSIS +-------- +*container create* ['OPTIONS'] + + +DESCRIPTION +----------- +The container-create command creates a container based on a script. + + +OPTIONS +------- +The following container-create options are available: + +*-n, --name='NAME'*:: + Specify container name. + +*-s, --script='SCRIPT'*:: + Specify container creation script, defaults to debootstrap. + +*-b, --bind='DIRECTORY:DIRECTORY[:OPTIONS][;DIRECTORY:DIRECTORY[:OPTIONS]]'*:: + Specify container bind mounts, see systemd-nspawn(1) --bind option. + + +SCRIPTS +------- +The following container scripts are available: + +*debootstrap*:: + Basic script to create Debian container, see container-create-debootstrap(1). + + +EXAMPLES +-------- +*Create example.net container using debootstrap script:*:: + sudo container create -n example.net -s debootstrap + + +SEE ALSO +-------- +container-tools(7), +container(1). + + +HOMEPAGE +-------- +More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. + + +BUGS +---- +Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. + + +AUTHORS +------- +container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net>. diff --git a/share/man/container-list.1.txt b/share/man/container-list.1.txt new file mode 100644 index 0000000..58493a2 --- /dev/null +++ b/share/man/container-list.1.txt @@ -0,0 +1,69 @@ +// Open Infrastructure: container-tools +// 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/>. + +CONTAINER-LIST(1) +================= +:doctype: manpage +:man manual: Open Infrastructure +:man source: container-tools +:man version: {revnumber} + + +NAME +---- +container-list - List container on the system + + +SYNOPSIS +-------- +*container list* ['OPTIONS'] + + +DESCRIPTION +----------- +The container list command lists container on the system. + + +OPTIONS +------- +This command has no options. + + +EXAMPLES +-------- +*List container on the the system:*:: + sudo container list + + +SEE ALSO +-------- +container-tools(7), +container(1). + + +HOMEPAGE +-------- +More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. + + +BUGS +---- +Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. + + +AUTHORS +------- +container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net>. diff --git a/share/man/container-remove.1.txt b/share/man/container-remove.1.txt new file mode 100644 index 0000000..b04560f --- /dev/null +++ b/share/man/container-remove.1.txt @@ -0,0 +1,78 @@ +// Open Infrastructure: container-tools +// 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/>. + +CONTAINER-REMOVE(1) +=================== +:doctype: manpage +:man manual: Open Infrastructure +:man source: container-tools +:man version: {revnumber} + + +NAME +---- +container-remove - Remove a container + + +SYNOPSIS +-------- +*container remove* ['OPTIONS'] + + +DESCRIPTION +----------- +The container remove command removes a container. + + +OPTIONS +------- +The following container options are available: + +*-n, --name='NAME'*:: + Specify container name. + +*-f, --force*:: + Do not prompt before removal. + + +EXAMPLES +-------- +*Remove example.net container from the system:*:: + sudo container remove -n example.net + +*Remove example.net container from the system without prompt:*:: + sudo container remove -n example.net -f + + +SEE ALSO +-------- +container-tools(7), +container(1). + + +HOMEPAGE +-------- +More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. + + +BUGS +---- +Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. + + +AUTHORS +------- +container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net>. diff --git a/share/man/container-restart.1.txt b/share/man/container-restart.1.txt new file mode 100644 index 0000000..a388c81 --- /dev/null +++ b/share/man/container-restart.1.txt @@ -0,0 +1,72 @@ +// Open Infrastructure: container-tools +// 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/>. + +CONTAINER-RESTART(1) +==================== +:doctype: manpage +:man manual: Open Infrastructure +:man source: container-tools +:man version: {revnumber} + + +NAME +---- +container-restart - Restart a container + + +SYNOPSIS +-------- +*container restart* ['OPTIONS'] + + +DESCRIPTION +----------- +The container restart command restarts a container. + + +OPTIONS +------- +The following container options are available: + +*-n, --name='NAME'*:: + Specify container name. + + +EXAMPLES +-------- +*Restart example.net container:*:: + sudo container restart -n example.net + + +SEE ALSO +-------- +container-tools(7), +container(1). + + +HOMEPAGE +-------- +More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. + + +BUGS +---- +Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. + + +AUTHORS +------- +container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net>. diff --git a/share/man/container-start.1.txt b/share/man/container-start.1.txt new file mode 100644 index 0000000..4bd9039 --- /dev/null +++ b/share/man/container-start.1.txt @@ -0,0 +1,72 @@ +// Open Infrastructure: container-tools +// 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/>. + +CONTAINER-START(1) +================== +:doctype: manpage +:man manual: Open Infrastructure +:man source: container-tools +:man version: {revnumber} + + +NAME +---- +container-start - Start a container + + +SYNOPSIS +-------- +*container start* ['OPTIONS'] + + +DESCRIPTION +----------- +The container start command starts a container. + + +OPTIONS +------- +The following container options are available: + +*-n, --name='NAME'*:: + Specify container name. + + +EXAMPLES +-------- +*Start example.net container:*:: + sudo container start -n example.net + + +SEE ALSO +-------- +container-tools(7), +container(1). + + +HOMEPAGE +-------- +More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. + + +BUGS +---- +Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. + + +AUTHORS +------- +container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net>. diff --git a/share/man/container-stop.1.txt b/share/man/container-stop.1.txt new file mode 100644 index 0000000..517a1cf --- /dev/null +++ b/share/man/container-stop.1.txt @@ -0,0 +1,78 @@ +// Open Infrastructure: container-tools +// 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/>. + +CONTAINER-STOP(1) +================= +:doctype: manpage +:man manual: Open Infrastructure +:man source: container-tools +:man version: {revnumber} + + +NAME +---- +container-stop - Stop a container + + +SYNOPSIS +-------- +*container stop* ['OPTIONS'] + + +DESCRIPTION +----------- +The container stop command stops a container by running the proper shutdown sequence. + + +OPTIONS +------- +The following container options are available: + +*-n, --name='NAME'*:: + Specify container name. + +*-k, --kill*:: + Instead of running the proper shutdown sequence, terminate all processes of the container imediatly. + + +EXAMPLES +-------- +*Shutdown example.net container:*:: + sudo container stop -n example.net + +*Immediately stop example.net container:*:: + sudo container stop -n example.net -k + + +SEE ALSO +-------- +container-tools(7), +container(1). + + +HOMEPAGE +-------- +More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. + + +BUGS +---- +Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. + + +AUTHORS +------- +container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net>. diff --git a/share/man/container-tools.7.txt b/share/man/container-tools.7.txt new file mode 100644 index 0000000..e94afcc --- /dev/null +++ b/share/man/container-tools.7.txt @@ -0,0 +1,100 @@ +// Open Infrastructure: container-tools +// 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/>. + +CONTAINER-TOOLS(7) +================== +:doctype: manpage +:man manual: Open Infrastructure +:man source: container-tools +:man version: {revnumber} + + +NAME +---- +container-tools - Manage systemd-nspawn Containers + + +DESCRIPTION +----------- +"[A Linux Container] is an operating-system-level virtualization environment for running multiple isolated Linux systems (containers) on a single Linux control host.":: + -- Wikipedia (https://en.wikipedia.org/wiki/LXC) + +container-tools provides the integration for Debian based Containers using systemd-nspawn. + + +DOWNLOAD +-------- + + * https://github.com/open-infrastructure/container-tools + + +USAGE +----- + +*Create a new container:*:: + sudo container create -n NAME + +*Start a container:*:: + sudo container start -n NAME + +*Restart a container:*:: + sudo container restart -n NAME + +*Stop a container:*:: + sudo container stop -n NAME + +*Remove a container:*:: + sudo container remove -n NAME + +*Attach console to a container:*:: + sudo container console -n NAME + +*List container on the system:*:: + sudo container list + +*Show container-tools version:*:: + container version + + +LINKS +----- + +*2016-02-24: Systemd vs. Docker*:: + https://lwn.net/Articles/676831/ + +*2015-06-10: Systemd and containers*:: + https://lwn.net/Articles/647634/ + +*2014-07-07: Control groups*:: + https://lwn.net/Articles/604609/ + +*2013-11-13: Systemd-Nspawn is Chroot on Steroids [LinuxCon Europe]*:: + https://www.youtube.com/watch?v=s7LlUs5D9p4 + +*2013-11-03: Creating containers with systemd-nspawn*:: + https://lwn.net/Articles/572957/ + +*2013-02-06: Systemd lightweight containers*:: + https://lwn.net/Articles/536033/ + +*2013-01-04: Namespaces in operation*:: + https://lwn.net/Articles/531114/ + + +AUTHORS +------- + + * Daniel Baumann <daniel.baumann@open-infrastructure.net> diff --git a/share/man/container-version.1.txt b/share/man/container-version.1.txt new file mode 100644 index 0000000..5fd4147 --- /dev/null +++ b/share/man/container-version.1.txt @@ -0,0 +1,69 @@ +// Open Infrastructure: container-tools +// 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/>. + +CONTAINER-VERSION(1) +==================== +:doctype: manpage +:man manual: Open Infrastructure +:man source: container-tools +:man version: {revnumber} + + +NAME +---- +container-version - Show container-tools version + + +SYNOPSIS +-------- +*container version* ['OPTIONS'] + + +DESCRIPTION +----------- +The container version command shows the container-tools version number. + + +OPTIONS +------- +This command has no options. + + +EXAMPLES +-------- +*Show container-tools version:*:: + container version + + +SEE ALSO +-------- +container-tools(7), +container(1). + + +HOMEPAGE +-------- +More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. + + +BUGS +---- +Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. + + +AUTHORS +------- +container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net>. diff --git a/share/man/container.1.txt b/share/man/container.1.txt new file mode 100644 index 0000000..54e3145 --- /dev/null +++ b/share/man/container.1.txt @@ -0,0 +1,115 @@ +// Open Infrastructure: container-tools +// 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/>. + +CONTAINER(1) +============ +:doctype: manpage +:man manual: Open Infrastructure +:man source: container-tools +:man version: {revnumber} + + +NAME +---- +container - Manage systemd-nspawn Containers + + +SYNOPSIS +-------- +*container* 'COMMAND' ['OPTIONS'] + + +DESCRIPTION +----------- +container-tools provides the integration for Debian based Containers using systemd-nspawn. + + +OPTIONS +------- +The following container common options are available: + +*-n, --name='NAME'*:: + Specify container name. + + +COMMANDS +-------- +The following container commands are available: + +*create*:: + Create a new container, see container-create(1). + +*start*:: + Start a container, see container-start(1). + +*restart*:: + Restart a container, see container-restart(1). + +*stop*:: + Stop a container, see container-stop(1). + +*remove*:: + Remove a container, see container-remove(1). + +*console*:: + Attach console to a container, see container-console(1). + +*list*:: + List container on the system, see container-list(1). + +*version*:: + Show container-tools version, see container-version(1). + + +FILES +----- +The following files are used: + +*/usr/bin/container*, */usr/bin/cnt*:: + Container program. + +*/usr/lib/container-tools*:: + Container commands. + +*/usr/share/container-tools*:: + Container shared data. + +*/usr/share/doc/container-tools*:: + Container documentation files. + +*/var/lib/machines*:: + Container root directory. + + +SEE ALSO +-------- +machinectl(1), +systemd-nspawn(1). + + +HOMEPAGE +-------- +More information about container-tools and the Open Infrastructure project can be found on the homepage at http://open-infrastructure.net. + + +BUGS +---- +Bugs can be reported by opening an issue in the GitHub repository at http://github.com/open-infrastructure/container-tools. + + +AUTHORS +------- +container-tools was written by Daniel Baumann <daniel.baumann@open-infrastructure.net>. diff --git a/share/scripts/debootstrap b/share/scripts/debootstrap new file mode 100755 index 0000000..0961fc9 --- /dev/null +++ b/share/scripts/debootstrap @@ -0,0 +1,135 @@ +#!/bin/sh + +# Open Infrastructure: container-tools +# 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 + +SCRIPT="${0}" + +MACHINES="/var/lib/machines" + +Parameters () +{ + LONG_OPTIONS="bind:,script:,name:,architecture:,distribution:,mirror:,password:" + OPTIONS="b:,s:,n:,a:,d:,m:,p:" + + PARAMETERS="$(getopt --longoptions ${LONG_OPTIONS} --name=${SCRIPT} --options ${OPTIONS} --shell sh -- ${@})" + + if [ "${?}" != "0" ] + then + echo "'${SCRIPT}': getopt exit" >&2 + exit 1 + fi + + eval set -- "${PARAMETERS}" + + while true + do + case "${1}" in + -b|--bind) + # ignore + shift 2 + ;; + + -s|--script) + # ignore + shift 2 + ;; + + -n|--name) + NAME="${2}" + shift 2 + ;; + + -a|--architecture) + ARCHITECTURE="${2}" + shift 2 + ;; + + -d|--distribution) + DISTRIBUTION="${2}" + shift 2 + ;; + + -m|--mirror) + MIRROR="${2}" + shift 2 + ;; + + -p|--password) + PASSWORD="${2}" + shift 2 + ;; + + --) + shift 1 + break + ;; + + *) + echo "'${SCRIPT}': getopt error" >&2 + exit 1 + ;; + esac + done +} + +Usage () +{ + echo "Usage: container create -n|--name NAME -s|--script ${SCRIPT} [-a|--architecture ARCHITECTURE] [-d|--distribution DISTRIBUTION] [-m|--mirror MIRROR] [-p|--password PASSWORD}" >&2 + exit 1 +} + +Parameters "${@}" + +if [ -z "${NAME}" ] +then + Usage +fi + +if [ -e "${MACHINES}/${NAME}" ] +then + echo "'${NAME}': container already exists" >&2 + exit 1 +fi + +if [ ! -x /usr/sbin/debootstrap ] +then + echo "'${NAME}': /usr/sbin/debootstrap - no such file." >&2 + exit 1 +fi + +if [ "$(id -u)" -ne 0 ] +then + echo "'${NAME}': need root privileges" >&2 + exit 1 +fi + +ARCHITECTURE="${ARCHITECTURE:-$(dpkg --print-architecture)}" +DISTRIBUTION="${DISTRIBUTION:-jessie}" +MIRROR="${MIRROR:-http://ftp.debian.org/debian}" +PASSWORD="${PASSWORD:-$(dd if=/dev/urandom bs=12 count=1 2> /dev/null | base64)}" + +debootstrap --arch=${ARCHITECTURE} --include=dbus ${DISTRIBUTION} ${MACHINES}/${NAME} ${MIRROR} +chroot "${MACHINES}/${NAME}" apt-get clean + +# Setting hostname +echo "${NAME}" > "${MACHINES}/${NAME}/etc/hostname" + +# Setting root password +echo root:${PASSWORD} | chroot "${MACHINES}/${NAME}" chpasswd +echo "${NAME}: root password set to '${PASSWORD}'." |