lxc.sgml.in revision 0fe2983a45c91fadcf6afdf82af018b7cb59ee72
5a580c3a38ced62d4bcc95b8ac7c4f2935b5d294Timo Sirainen<!--
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenlxc: linux Container library
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen(C) Copyright IBM Corp. 2007, 2008
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo SirainenAuthors:
0371406d952fe51367c7be91703e5634b7d9d225Timo SirainenDaniel Lezcano <daniel.lezcano at free.fr>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo SirainenThis library is free software; you can redistribute it and/or
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenmodify it under the terms of the GNU Lesser General Public
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo SirainenLicense as published by the Free Software Foundation; either
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenversion 2.1 of the License, or (at your option) any later version.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo SirainenThis library is distributed in the hope that it will be useful,
22627da0fb77c1d0d9a8e8bc485ef5540b6f2e69Timo Sirainenbut WITHOUT ANY WARRANTY; without even the implied warranty of
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo SirainenMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo SirainenLesser General Public License for more details.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo SirainenYou should have received a copy of the GNU Lesser General Public
6b2738c39a868ff9291867138c55029fc40cf105Timo SirainenLicense along with this library; if not, write to the Free Software
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo SirainenFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo SirainenTranslated into Japanese
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainenby KATOH Yasufumi <karma at jazz.email.ne.jp>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen-->
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen<!DOCTYPE refentry PUBLIC @docdtd@ [
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen<!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen]>
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen<refentry>
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen <docinfo>
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen <date>@LXC_GENERATE_DATE@</date>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </docinfo>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <refmeta>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <refentrytitle>lxc</refentrytitle>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <manvolnum>7</manvolnum>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <refmiscinfo>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen Version @PACKAGE_VERSION@
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </refmiscinfo>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </refmeta>
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainen
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen <refnamediv>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <refname>lxc</refname>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
68f0dfb4b2815ecbc1bd8d8a68adcfd577ec55aeTimo Sirainen <refpurpose>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <!--
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen linux containers
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -->
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen Linux コンテナ
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen </refpurpose>
9c2b0eb659540b9db8dd3a8a6a2515921fbe8eebTimo Sirainen </refnamediv>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen <refsect1>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen <title><!-- Quick start -->クイックスタート</title>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen <para>
892b3cbf0eba9ba455448adcf71864a409345c6dTimo Sirainen <!--
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen You are in a hurry, and you don't want to read this man page. Ok,
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen without warranty, here are the commands to launch a shell inside
f4c0b1874b0533bcf2df1d28d584ff02cfdae3faTimo Sirainen a container with a predefined configuration template, it may
f4c0b1874b0533bcf2df1d28d584ff02cfdae3faTimo Sirainen work.
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen <command>@BINDIR@/lxc-execute -n foo -f
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen @DOCDIR@/examples/lxc-macvlan.conf /bin/bash</command>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen -->
0db5b158a00c08955bdacc99b1e2cd1ec07f4311Timo Sirainen 急いでいて、この man ページすら読みたくないという場合は、いいでしょう、
0db5b158a00c08955bdacc99b1e2cd1ec07f4311Timo Sirainen 保証はないですが、あらかじめ準備されている設定テンプレートを使ったコンテナ内でシェルを動かすためのコマンドを紹介しましょう。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <command>@BINDIR@/lxc-execute -n foo -f
d16b506f5540e3407d256bda35624b38a5ecf88fTimo Sirainen @DOCDIR@/examples/lxc-macvlan.conf /bin/bash</command>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </para>
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen </refsect1>
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen
554c1c792dc6fce1e25c74555c2da786bffde75fTimo Sirainen <refsect1>
554c1c792dc6fce1e25c74555c2da786bffde75fTimo Sirainen <title><!-- Overview -->概要</title>
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen <para>
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen <!--
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen The container technology is actively being pushed into the
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen mainstream linux kernel. It provides the resource management
6df2db16b3920346ed07cefb86e8bdcb7e1faec5Timo Sirainen through the control groups aka process containers and resource
6df2db16b3920346ed07cefb86e8bdcb7e1faec5Timo Sirainen isolation through the namespaces.
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen -->
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen コンテナ技術は、メインストリームの linux kernel で活発に開発が進んでいる技術です。
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen コンテナ技術は、process container という名前でも知られる control groups の機能を使って、リソース管理を提供し、名前空間を使って、リソースの隔離を提供します。
35f3b7e05afecacd0332c210c6e253911c2813d8Timo Sirainen </para>
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen <para>
35f3b7e05afecacd0332c210c6e253911c2813d8Timo Sirainen <!--
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen The linux containers, <command>lxc</command>, aims to use these
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen new functionalities to provide a userspace container object
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen which provides full resource isolation and resource control for
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen an applications or a system.
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen -->
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen linux コンテナ (<command>lxc</command>) は、ユーザースペースのコンテナオブジェクトを提供するための新しい機能を使う事を目指しています。
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen この新しい機能とは、アプリケーションやシステムでの利用を目的とした、完全なリソースの隔離やリソースコントロールを提供する機能です。
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen </para>
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen <para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <!--
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen The first objective of this project is to make the life easier
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen for the kernel developers involved in the containers project and
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen especially to continue working on the Checkpoint/Restart new
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen features. The <command>lxc</command> is small enough to easily
407caeb5d0c8a6b158e2caef48dd909011d40340Timo Sirainen manage a container with simple command lines and complete enough
407caeb5d0c8a6b158e2caef48dd909011d40340Timo Sirainen to be used for other purposes.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -->
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen このプロジェクトの第一の目的は、コンテナプロジェクトに参加するカーネル開発者の作業を快適にすることと、特に新機能である Checkpoint/Restart 機能への取り組みを続ける事です。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <command>lxc</command> コマンドは、シンプルなコマンドでコンテナの管理を簡単に行えるように小さく、他の目的のために使うのに充分な機能を持っています。
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </refsect1>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen <refsect1>
a54fa00087ba926a3d966a8449d8d7579e89911cTimo Sirainen <title><!-- Requirements -->必要条件</title>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <!--
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen The <command>lxc</command> relies on a set of functionalities
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen provided by the kernel which needs to be active. Depending of
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen the missing functionalities the <command>lxc</command> will
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen work with a restricted number of functionalities or will simply
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen fail.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -->
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <command>lxc</command> は、カーネルが提供するいくつかの機能に依存しており、その機能がアクティブになっている必要があります。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen 機能が足りない場合は、<command>lxc</command> は、いくつかの機能が制限されるか、単純に動作が失敗します。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <!--
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen The following list gives the kernel features to be enabled in
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen the kernel to have the full features container:
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -->
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen 以下のリストは、コンテナの全機能を有効にするために、カーネルで有効にする必要のある機能の一覧です。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen * General setup
2cfe9983ce7a6280636ee12beccc2e865111967bTimo Sirainen * Control Group support
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -> Namespace cgroup subsystem
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -> Freezer cgroup subsystem
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -> Cpuset support
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -> Simple CPU accounting cgroup subsystem
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen -> Resource counters
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen -> Memory resource controllers for Control Groups
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen * Group CPU scheduler
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -> Basis for grouping tasks (Control Groups)
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen * Namespaces support
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -> UTS namespace
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -> IPC namespace
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -> User namespace
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -> Pid namespace
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -> Network namespace
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen * Device Drivers
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen * Character devices
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -> Support multiple instances of devpts
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen * Network device support
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -> MAC-VLAN support
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen -> Virtual ethernet pair device
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen * Networking
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen * Networking options
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -> 802.1d Ethernet Bridging
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen * Security options
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -> File POSIX Capabilities
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen </programlisting>
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <!--
d16b506f5540e3407d256bda35624b38a5ecf88fTimo Sirainen The kernel version >= 2.6.32 shipped with the distros, will
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen work with <command>lxc</command>, this one will have less
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen functionalities but enough to be interesting.
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen The helper script <command>lxc-checkconfig</command> will give
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen you information about your kernel configuration.
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen -->
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen 2.6.32 以上のバージョンが採用されているディストリビューションならば、<command>lxc</command> は動作するでしょう。
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen 機能的には若干少ない形ですが、充分に楽しめるはずです。
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen ヘルパースクリプトの <command>lxc-checkconfig</command> を使って、あなたのカーネルの設定に関する情報を取得できるでしょう。
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <!--
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen The control group can be mounted anywhere, eg:
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <command>mount -t cgroup cgroup /cgroup</command>.
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen It is however recommended to use cgmanager, cgroup-lite or systemd
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen to mount the cgroup hierarchy under /sys/fs/cgroup.
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen -->
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen control group は、どこにでもマウント可能です。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen 例えば、<command>mount -t cgroup cgroup /cgroup</command> のようにです。
a0b89f3b1df99b3a32f44623f13ad1893118825bTimo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen しかし、cgroup の階層構造を /sys/fs/cgroup 以下にマウントするために cgmanager や cgroup-lite や systemd の使用が推奨されています。
a0b89f3b1df99b3a32f44623f13ad1893118825bTimo Sirainen </para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </refsect1>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <refsect1>
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen <title><!-- Functional specification -->機能仕様</title>
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen <para>
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen <!--
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen A container is an object isolating some resources of the host,
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen for the application or system running in it.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -->
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen コンテナは、コンテナ内で実行されているシステムやアプリケーションに対するホストのリソースのいくつかが、隔離されているオブジェクトです。
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen </para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <para>
a0b89f3b1df99b3a32f44623f13ad1893118825bTimo Sirainen <!--
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen The application / system will be launched inside a
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen container specified by a configuration that is either
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen initially created or passed as parameter of the starting
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen commands.
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen -->
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen アプリケーション/システムは、あらかじめ作成された設定もしくは開始コマンドのパラメータで指定された設定で、コンテナ内で実行されます。
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <!--
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen How to run an application in a container ?
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen -->
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen どうやってコンテナ内でアプリケーションを実行するのでしょう?
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <!--
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen Before running an application, you should know what are the
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen resources you want to isolate. The default configuration is to
9349a0afffad990e45d3ad33081e1d2d9e68a753Timo Sirainen isolate the pids, the sysv ipc and the mount points. If you want
9349a0afffad990e45d3ad33081e1d2d9e68a753Timo Sirainen to run a simple shell inside a container, a basic configuration
9349a0afffad990e45d3ad33081e1d2d9e68a753Timo Sirainen is needed, especially if you want to share the rootfs. If you
4c9c55e15f35474f53f11659e796c63b1c34e884Timo Sirainen want to run an application like <command>sshd</command>, you
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen should provide a new network stack and a new hostname. If you
4c9c55e15f35474f53f11659e796c63b1c34e884Timo Sirainen want to avoid conflicts with some files
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen eg. <filename>/var/run/httpd.pid</filename>, you should
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen remount <filename>/var/run</filename> with an empty
a94936bafd127680184da114c6a177b37ff656e5Timo Sirainen directory. If you want to avoid the conflicts in all the cases,
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen you can specify a rootfs for the container. The rootfs can be a
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen directory tree, previously bind mounted with the initial rootfs,
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen so you can still use your distro but with your
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen own <filename>/etc</filename> and <filename>/home</filename>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -->
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen アプリケーションを実行する前に、隔離したいリソースについて知っておくべきです。
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen デフォルトの設定では、pid、sysv ipc、マウントポイントが隔離されます。
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen コンテナ内でシンプルなシェルを実行したい場合で、特に rootfs を共有したい場合、基本的な設定が必要です。
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen もし、<command>sshd</command> のようなアプリケーションを実行したい場合、新しいネットワークスタックと、新しいホスト名を準備しなくてはなりません。
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen もし、同じファイル (<filename>/var/run/httpd.pid</filename> 等) の衝突を避けたい場合、空の <filename>/var/run/</filename> を再度マウントしなければなりません。
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen どんな場合でも、衝突を避けたい場合、コンテナ専用の rootfs を指定することができます。
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen rootfs はディレクトリツリーとなる事も可能で、前もって元の rootfs を bind マウントし、しかし、自身の <filename>/etc</filename> や <filename>/home</filename>を使って。自身のディストリビューションを使うことが可能です。
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen </para>
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen <para>
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen <!--
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen Here is an example of directory tree
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen for <command>sshd</command>:
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <programlisting>
a94936bafd127680184da114c6a177b37ff656e5Timo Sirainen[root@lxc sshd]$ tree -d rootfs
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainenrootfs
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen|&#045;&#045; bin
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen|&#045;&#045; dev
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen| |&#045;&#045; pts
d16b506f5540e3407d256bda35624b38a5ecf88fTimo Sirainen| `&#045;&#045; shm
4c9c55e15f35474f53f11659e796c63b1c34e884Timo Sirainen| `&#045;&#045; network
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen|&#045;&#045; etc
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen| `&#045;&#045; ssh
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen|&#045;&#045; lib
22627da0fb77c1d0d9a8e8bc485ef5540b6f2e69Timo Sirainen|&#045;&#045; proc
3e28b527dd6048a40684afd29cff0ee008fc0014Timo Sirainen|&#045;&#045; root
3e28b527dd6048a40684afd29cff0ee008fc0014Timo Sirainen|&#045;&#045; sbin
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen|&#045;&#045; sys
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen|&#045;&#045; usr
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen`&#045;&#045; var
ccffb125d94adff0ad776de5a96e22f864d6fb0aTimo Sirainen |&#045;&#045; empty
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen | `&#045;&#045; sshd
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen |&#045;&#045; lib
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen | `&#045;&#045; empty
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen | `&#045;&#045; sshd
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen `&#045;&#045; run
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen `&#045;&#045; sshd
ccffb125d94adff0ad776de5a96e22f864d6fb0aTimo Sirainen </programlisting>
ccffb125d94adff0ad776de5a96e22f864d6fb0aTimo Sirainen
2cfe9983ce7a6280636ee12beccc2e865111967bTimo Sirainen and the mount points file associated with it:
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <programlisting>
c44f402f17f9a58ead24ac0083945cae86fb172bTimo Sirainen [root@lxc sshd]$ cat fstab
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen /lib /home/root/sshd/rootfs/lib none ro,bind 0 0
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen /bin /home/root/sshd/rootfs/bin none ro,bind 0 0
c44f402f17f9a58ead24ac0083945cae86fb172bTimo Sirainen /usr /home/root/sshd/rootfs/usr none ro,bind 0 0
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen /sbin /home/root/sshd/rootfs/sbin none ro,bind 0 0
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen </programlisting>
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen -->
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen ここで、<command>sshd</command> のためのディレクトリツリーのサンプルを示しましょう。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <programlisting>
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen[root@lxc sshd]$ tree -d rootfs
c44f402f17f9a58ead24ac0083945cae86fb172bTimo Sirainen
c44f402f17f9a58ead24ac0083945cae86fb172bTimo Sirainenrootfs
c44f402f17f9a58ead24ac0083945cae86fb172bTimo Sirainen|-- bin
c44f402f17f9a58ead24ac0083945cae86fb172bTimo Sirainen|-- dev
c44f402f17f9a58ead24ac0083945cae86fb172bTimo Sirainen| |-- pts
c44f402f17f9a58ead24ac0083945cae86fb172bTimo Sirainen| `-- shm
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen| `-- network
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen|-- etc
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen| `-- ssh
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen|-- lib
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen|-- proc
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen|-- root
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen|-- sbin
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen|-- sys
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen|-- usr
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen`-- var
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen |-- empty
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen | `-- sshd
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen |-- lib
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen | `-- empty
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen | `-- sshd
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen `-- run
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen `-- sshd
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen </programlisting>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen そして、それに対応するマウントポイントのファイルは以下のようになります。
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <programlisting>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen [root@lxc sshd]$ cat fstab
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
a1aaf11831cab8346d6d0dc702e37b3f1d95eb43Timo Sirainen /lib /home/root/sshd/rootfs/lib none ro,bind 0 0
a1aaf11831cab8346d6d0dc702e37b3f1d95eb43Timo Sirainen /bin /home/root/sshd/rootfs/bin none ro,bind 0 0
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen /usr /home/root/sshd/rootfs/usr none ro,bind 0 0
a1aaf11831cab8346d6d0dc702e37b3f1d95eb43Timo Sirainen /sbin /home/root/sshd/rootfs/sbin none ro,bind 0 0
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
c44f402f17f9a58ead24ac0083945cae86fb172bTimo Sirainen <para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <!--
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen How to run a system in a container ?
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen -->
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen コンテナ内でシステムを実行する方法は?
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <!--
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen Running a system inside a container is paradoxically easier
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen than running an application. Why ? Because you don't have to care
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen about the resources to be isolated, everything need to be
e20e638805c4bd54e039891a3e92760b1dfa189aTimo Sirainen isolated, the other resources are specified as being isolated but
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen without configuration because the container will set them
e20e638805c4bd54e039891a3e92760b1dfa189aTimo Sirainen up. eg. the ipv4 address will be setup by the system container
e20e638805c4bd54e039891a3e92760b1dfa189aTimo Sirainen init scripts. Here is an example of the mount points file:
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen <programlisting>
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen [root@lxc debian]$ cat fstab
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen /dev /home/root/debian/rootfs/dev none bind 0 0
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen /dev/pts /home/root/debian/rootfs/dev/pts none bind 0 0
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen More information can be added to the container to facilitate the
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen configuration. For example, make accessible from the container
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen the resolv.conf file belonging to the host.
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <programlisting>
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen /etc/resolv.conf /home/root/debian/rootfs/etc/resolv.conf none bind 0 0
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </programlisting>
68f0dfb4b2815ecbc1bd8d8a68adcfd577ec55aeTimo Sirainen -->
e958a3c4573058f17999f0083a34080ca35e34d8Timo Sirainen コンテナ内でシステムを実行するのは、逆説的ではありますが、アプリケーションを実行するよりも簡単です。
e958a3c4573058f17999f0083a34080ca35e34d8Timo Sirainen それは、隔離するリソースについて考える必要がないからで、全てを隔離する必要があるからです。
e958a3c4573058f17999f0083a34080ca35e34d8Timo Sirainen 他のリソースは、コンテナが設定を行うので、設定なしで隔離されるように指定されます。
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen 例えば、IPv4 アドレスはコンテナの init スクリプトでシステムによってセットアップされるでしょう。
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen 以下に、(システムを実行するときの) マウントポイントファイルを示します。
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <programlisting>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen [root@lxc debian]$ cat fstab
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen /dev /home/root/debian/rootfs/dev none bind 0 0
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen /dev/pts /home/root/debian/rootfs/dev/pts none bind 0 0
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </programlisting>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen 設定を手助けするために、コンテナに更なる情報を追加することも可能です。
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen 例えば、ホスト上に存在する resolv.conf ファイルをコンテナからアクセス可能にするには、以下のようにします。
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <programlisting>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen /etc/resolv.conf /home/root/debian/rootfs/etc/resolv.conf none bind 0 0
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </programlisting>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
68f0dfb4b2815ecbc1bd8d8a68adcfd577ec55aeTimo Sirainen <refsect2>
68f0dfb4b2815ecbc1bd8d8a68adcfd577ec55aeTimo Sirainen <title><!-- Container life cycle -->コンテナのライフサイクル</title>
3656c91dcb8336814bebd4500e81c3dde25233e6Timo Sirainen <para>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen <!--
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen When the container is created, it contains the configuration
2cfe9983ce7a6280636ee12beccc2e865111967bTimo Sirainen information. When a process is launched, the container will be
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen starting and running. When the last process running inside the
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen container exits, the container is stopped.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -->
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen コンテナが作成されるとき、コンテナは設定情報を含みます。
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen プロセスが生成されるとき、コンテナは開始し、実行されるでしょう。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen コンテナ内で実行されている最後のプロセスが終了したとき、コンテナは停止します。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <!--
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen In case of failure when the container is initialized, it will
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen pass through the aborting state.
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen -->
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen コンテナの初期化時の失敗の場合は、(以下の図の) 中断の状態を通ります。
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen </para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen<![CDATA[
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen ---------
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen | STOPPED |<---------------
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen --------- |
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen | |
2cfe9983ce7a6280636ee12beccc2e865111967bTimo Sirainen start |
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen | |
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen V |
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen ---------- |
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen | STARTING |--error- |
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen ---------- | |
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen | | |
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen V V |
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen --------- ---------- |
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen | RUNNING | | ABORTING | |
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen --------- ---------- |
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen | | |
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen no process | |
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen | | |
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen V | |
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen ---------- | |
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen | STOPPING |<------- |
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen ---------- |
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen | |
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen ---------------------
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen]]>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </refsect2>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <refsect2>
f119596e34bc4a7ce374f4aa5f4f1eb12061a372Timo Sirainen <title><!-- Configuration -->設定</title>
f119596e34bc4a7ce374f4aa5f4f1eb12061a372Timo Sirainen <para>
f119596e34bc4a7ce374f4aa5f4f1eb12061a372Timo Sirainen <!--
f119596e34bc4a7ce374f4aa5f4f1eb12061a372Timo Sirainen The container is configured through a configuration
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen file, the format of the configuration file is described in
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <citerefentry>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <refentrytitle><filename>lxc.conf</filename></refentrytitle>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <manvolnum>5</manvolnum>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </citerefentry>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen -->
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen コンテナは設定ファイル経由で設定します。設定の書式は以下で説明しています。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <citerefentry>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <refentrytitle><filename>lxc.conf</filename></refentrytitle>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <manvolnum>5</manvolnum>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </citerefentry>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </refsect2>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
294c71436de227178c709e4d498e7be9b5d8d7feTimo Sirainen <refsect2>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <title><!--Creating / Destroying container
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen (persistent container) -->コンテナの生成と終了 (持続性のコンテナ)</title>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <!--
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen A persistent container object can be
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen created via the <command>lxc-create</command>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen command. It takes a container name as parameter and
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen optional configuration file and template.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen The name is used by the different
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen commands to refer to this
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen container. The <command>lxc-destroy</command> command will
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen destroy the container object.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen lxc-create -n foo
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen lxc-destroy -n foo
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen </programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -->
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen 持続性のコンテナオブジェクトは <command>lxc-create</command> コマンドで作成することができます。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen コマンドにはコンテナ名をパラメータとして、オプションで設定ファイルとテンプレートを指定します。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen ここで指定する名前は、他のコマンドからこのコンテナを参照する際に使います。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <command>lxc-destroy</command> コマンドはコンテナオブジェクトを破壊します。
13a8c553f293349248b161ff851743498916e26eTimo Sirainen <programlisting>
13a8c553f293349248b161ff851743498916e26eTimo Sirainen lxc-create -n foo
24ce0c343cefe54af841871fa39dbc3464028b06Timo Sirainen lxc-destroy -n foo
24ce0c343cefe54af841871fa39dbc3464028b06Timo Sirainen </programlisting>
24ce0c343cefe54af841871fa39dbc3464028b06Timo Sirainen </para>
24ce0c343cefe54af841871fa39dbc3464028b06Timo Sirainen </refsect2>
24ce0c343cefe54af841871fa39dbc3464028b06Timo Sirainen
24ce0c343cefe54af841871fa39dbc3464028b06Timo Sirainen <refsect2>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <title><!-- Volatile container -->揮発性のコンテナ</title>
9fcf7b79236b0045f7709718f7b65ada516565e7Timo Sirainen <para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <!--
9fcf7b79236b0045f7709718f7b65ada516565e7Timo Sirainen It is not mandatory to create a container object
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen before to start it.
a10ed8c47534b4c6b6bf2711ccfe577e720a47b4Timo Sirainen The container can be directly started with a
a10ed8c47534b4c6b6bf2711ccfe577e720a47b4Timo Sirainen configuration file as parameter.
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen -->
a10ed8c47534b4c6b6bf2711ccfe577e720a47b4Timo Sirainen コンテナを開始する前にコンテナオブジェクトを作成する必要はありません。
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen コンテナを設定ファイルのパラメータで指定して直接開始することができます。
24ce0c343cefe54af841871fa39dbc3464028b06Timo Sirainen </para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </refsect2>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <refsect2>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <title><!-- Starting / Stopping container -->コンテナの開始と終了</title>
24ce0c343cefe54af841871fa39dbc3464028b06Timo Sirainen <para>
24ce0c343cefe54af841871fa39dbc3464028b06Timo Sirainen <!--
24ce0c343cefe54af841871fa39dbc3464028b06Timo Sirainen When the container has been created, it is ready to run an
24ce0c343cefe54af841871fa39dbc3464028b06Timo Sirainen application / system.
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen This is the purpose of the <command>lxc-execute</command> and
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <command>lxc-start</command> commands.
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen If the container was not created before
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen starting the application, the container will use the
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen configuration file passed as parameter to the command,
5fbf8719b9ef072295c16bc4492f9f0ece92117dTimo Sirainen and if there is no such parameter either, then
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen it will use a default isolation.
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen If the application is ended, the container will be stopped also,
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen but if needed the <command>lxc-stop</command> command can
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen be used to kill the still running application.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -->
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen コンテナが作成されると、アプリケーションもしくはシステムとして実行することができます。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen このために使用するのが <command>lxc-execute</command> と <command>lxc-start</command> コマンドです。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen アプリケーションが開始する前にコンテナが作成されなかった場合、コンテナはコマンドへ与えるパラメータを取得するのに設定ファイルを使うでしょう。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen もし、このようなパラメータもない場合は、デフォルトで指定されている通りに隔離されます。
3656c91dcb8336814bebd4500e81c3dde25233e6Timo Sirainen アプリケーションが終了した場合、コンテナも停止しますが、実行中のアプリケーションを停止するには <command>lxc-stop</command> を使用する必要があります。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <!--
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen Running an application inside a container is not exactly the
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen same thing as running a system. For this reason, there are two
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen different commands to run an application into a container:
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen lxc-execute -n foo [-f config] /bin/bash
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen lxc-start -n foo [-f config] [/bin/bash]
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -->
3656c91dcb8336814bebd4500e81c3dde25233e6Timo Sirainen コンテナ内のアプリケーションの実行は、正確にはシステムとして実行するのとは異なります。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen そのような理由で、コンテナ内でアプリケーションを実行するためのコマンドには、2 種類の違ったものがあります。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen lxc-execute -n foo [-f config] /bin/bash
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen lxc-start -n foo [-f config] [/bin/bash]
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </programlisting>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen </para>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen <para>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen <!--
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen <command>lxc-execute</command> command will run the
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen specified command into the container via an intermediate
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen process, <command>lxc-init</command>.
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen This lxc-init after launching the specified command,
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen will wait for its end and all other reparented processes.
36c4702131e5a04984ad5d07cf5d8d5c633d43c3Timo Sirainen (to support daemons in the container).
36c4702131e5a04984ad5d07cf5d8d5c633d43c3Timo Sirainen In other words, in the
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen container, <command>lxc-init</command> has the pid 1 and the
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen first process of the application has the pid 2.
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen -->
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <command>lxc-execute</command> コマンドは、<command>lxc-init</command> プロセス経由で、コンテナ内で特定のコマンドを実行します。
5fe06fea9fee0f5e4e9cb49f6866877223f78b85Timo Sirainen lxc-init はコマンドを実行した後、(コンテナ内でのデーモンの実行をサポートするために) 実行したコマンドと生成された全てのプロセスが終了するのを待ちます。
5fe06fea9fee0f5e4e9cb49f6866877223f78b85Timo Sirainen 言いかえると、コンテナ内では <command>lxc-init</command> は pid 1 を持ち、アプリケーションの最初のプロセスは pid 2 をもちます。
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </para>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen <para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <!--
36c4702131e5a04984ad5d07cf5d8d5c633d43c3Timo Sirainen <command>lxc-start</command> command will run directly the specified
ab1b9a793d57a60c230a41f65f1a25d52c026233Timo Sirainen command into the container.
36c4702131e5a04984ad5d07cf5d8d5c633d43c3Timo Sirainen The pid of the first process is 1. If no command is
36c4702131e5a04984ad5d07cf5d8d5c633d43c3Timo Sirainen specified <command>lxc-start</command> will
36c4702131e5a04984ad5d07cf5d8d5c633d43c3Timo Sirainen run the command defined in lxc.init_cmd or if not set,
36c4702131e5a04984ad5d07cf5d8d5c633d43c3Timo Sirainen <filename>/sbin/init</filename> .
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen -->
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <command>lxc-start</command> コマンドは、コンテナ内の特定のコマンドを直接実行します。
36c4702131e5a04984ad5d07cf5d8d5c633d43c3Timo Sirainen 最初のプロセスの pid が 1 となります。
36c4702131e5a04984ad5d07cf5d8d5c633d43c3Timo Sirainen もし、実行するコマンドが指定されない場合は、<command>lxc-start</command> は lxc.init_cmd で設定されたコマンドを実行します。もし lxc.init_cmd が設定されていない場合は <filename>/sbin/init</filename> を実行します。
36c4702131e5a04984ad5d07cf5d8d5c633d43c3Timo Sirainen </para>
36c4702131e5a04984ad5d07cf5d8d5c633d43c3Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <!--
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen To summarize, <command>lxc-execute</command> is for running
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen an application and <command>lxc-start</command> is better suited for
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen running a system.
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen -->
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen まとめると、<command>lxc-execute</command> はアプリケーションを実行するためのコマンドであり、<command>lxc-start</command> はシステムを実行するのにより適したコマンドです。
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen <para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <!--
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen If the application is no longer responding, is inaccessible or is
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen not able to finish by itself, a
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen wild <command>lxc-stop</command> command will kill all the
840a3701b7a0f7fadd17738998c33790a8dfad2dTimo Sirainen processes in the container without pity.
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <programlisting>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen lxc-stop -n foo
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </programlisting>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen -->
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen もしアプリケーションの反応がなくなった場合や、アクセスできなくなった場合、自分で終了することができない場合は、荒っぽいですが、<command>lxc-stop</command> コマンドがコンテナ内の全てのプロセスを容赦なく停止させてくれるでしょう。
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </refsect2>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <refsect2>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <title><!-- Connect to an available tty -->利用可能な tty への接続</title>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <!--
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen If the container is configured with the ttys, it is possible
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen to access it through them. It is up to the container to
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen provide a set of available tty to be used by the following
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen command. When the tty is lost, it is possible to reconnect it
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen without login again.
f6e301cb2060c4367d8145e2bf5d553ba87ceb34Timo Sirainen <programlisting>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen lxc-console -n foo -t 3
06f537a8e0b399222cc2a7755015ef3963525fd2Timo Sirainen </programlisting>
06f537a8e0b399222cc2a7755015ef3963525fd2Timo Sirainen -->
06f537a8e0b399222cc2a7755015ef3963525fd2Timo Sirainen コンテナが tty を持つように設定されているならば、tty を通してコンテナにアクセスすることができます。
06f537a8e0b399222cc2a7755015ef3963525fd2Timo Sirainen それは以下のコマンドが使う tty がコンテナで利用可能に設定されているか次第です。
06f537a8e0b399222cc2a7755015ef3963525fd2Timo Sirainen tty が失われたとき、再度のログインなしでその tty に再接続することが可能です。
87b8a4b6805d0b13af6a417dc70bdc74027bf1d3Timo Sirainen <programlisting>
87b8a4b6805d0b13af6a417dc70bdc74027bf1d3Timo Sirainen lxc-console -n foo -t 3
87b8a4b6805d0b13af6a417dc70bdc74027bf1d3Timo Sirainen </programlisting>
06f537a8e0b399222cc2a7755015ef3963525fd2Timo Sirainen </para>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen </refsect2>
06f537a8e0b399222cc2a7755015ef3963525fd2Timo Sirainen
06f537a8e0b399222cc2a7755015ef3963525fd2Timo Sirainen <refsect2>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen <title><!-- Freeze / Unfreeze container -->コンテナの凍結と解凍</title>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen <para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <!--
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen Sometime, it is useful to stop all the processes belonging to
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen a container, eg. for job scheduling. The commands:
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <programlisting>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen lxc-freeze -n foo
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </programlisting>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen will put all the processes in an uninteruptible state and
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <programlisting>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen lxc-unfreeze -n foo
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen will resume them.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -->
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen ジョブスケジューリングなどで、コンテナに属する全てのプロセスを停止する事が役に立つときがあります。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen コマンド
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen lxc-freeze -n foo
26cdaf7097427fa90343260fa236af12ab93cca3Timo Sirainen </programlisting>
26cdaf7097427fa90343260fa236af12ab93cca3Timo Sirainen は、全てのプロセスを中断不可能な状態に置きます。そして、
26cdaf7097427fa90343260fa236af12ab93cca3Timo Sirainen
26cdaf7097427fa90343260fa236af12ab93cca3Timo Sirainen <programlisting>
26cdaf7097427fa90343260fa236af12ab93cca3Timo Sirainen lxc-unfreeze -n foo
26cdaf7097427fa90343260fa236af12ab93cca3Timo Sirainen </programlisting>
26cdaf7097427fa90343260fa236af12ab93cca3Timo Sirainen
26cdaf7097427fa90343260fa236af12ab93cca3Timo Sirainen その全てのプロセスを再開します。
26cdaf7097427fa90343260fa236af12ab93cca3Timo Sirainen </para>
26cdaf7097427fa90343260fa236af12ab93cca3Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <!--
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen This feature is enabled if the cgroup freezer is enabled in the
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen kernel.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -->
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen この機能は、カーネルで cgroup freezer 機能が有効になっている場合に使用可能です。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </refsect2>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <refsect2>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <title><!-- Getting information about container -->
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen コンテナに関する情報の取得</title>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <!--
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen When there are a lot of containers, it is hard to follow
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen what has been created or destroyed, what is running or what are
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen the pids running into a specific container. For this reason, the
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen following commands may be useful:
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen lxc-ls
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen lxc-info -n foo
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </programlisting>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen -->
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen 多数のコンテナが存在する場合、それらが実行されたり破壊されたりすること、何が実行されていて、特定のコンテナ内で実行されている pid が何であるかをフォローするのは大変です。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen このような時には、以下のようなコマンドが役に立つかもしれません。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen lxc-ls
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen lxc-info -n foo
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <!--
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <command>lxc-ls</command> lists the containers of the
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen system.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -->
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <command>lxc-ls</command> は、システムのコンテナを一覧します。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <!--
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <command>lxc-info</command> gives information for a specific
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen container.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -->
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <command>lxc-info</command> は、指定したコンテナに関する情報を取得します。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <!--
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen Here is an example on how the combination of these commands
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen allows one to list all the containers and retrieve their state.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen for i in $(lxc-ls -1); do
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen lxc-info -n $i
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen done
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -->
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen ここで、以上のコマンドを組み合わせて、どのようにしたら全てのコンテナのリストと、それぞれの状態が得られるかの例を示します。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen for i in $(lxc-ls -1); do
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen lxc-info -n $i
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen done
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </refsect2>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <refsect2>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <title><!-- Monitoring container -->コンテナのモニタリング</title>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <!--
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen It is sometime useful to track the states of a container,
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen for example to monitor it or just to wait for a specific
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen state in a script.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -->
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen 時々、コンテナの状態を追跡することが出来ると便利な事があります。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen 例えば、状態をモニタリングしたり、スクリプト内で特定の状態を待ったりするような場合です。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <!--
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <command>lxc-monitor</command> command will monitor one or
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen several containers. The parameter of this command accept a
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen regular expression for example:
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen lxc-monitor -n "foo|bar"
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </programlisting>
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen will monitor the states of containers named 'foo' and 'bar', and:
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen <programlisting>
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen lxc-monitor -n ".*"
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen </programlisting>
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen will monitor all the containers.
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen -->
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen <command>lxc-monitor</command> コマンドは、一つもしくはいくつかのコンテナをモニタリングします。
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen このコマンドのパラメータは、正規表現を受け付けます。例えば
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen <programlisting>
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen lxc-monitor -n "foo|bar"
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen </programlisting>
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen は 'foo' と 'bar' という名前のコンテナの状態をモニタリングします。そして、
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen <programlisting>
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen lxc-monitor -n ".*"
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen </programlisting>
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen は全てのコンテナの状態をモニタリングします。
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen </para>
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen <para>
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen <!--
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen For a container 'foo' starting, doing some work and exiting,
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen the output will be in the form:
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen <programlisting>
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen 'foo' changed state to [STARTING]
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen 'foo' changed state to [RUNNING]
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen 'foo' changed state to [STOPPING]
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen 'foo' changed state to [STOPPED]
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen </programlisting>
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen -->
1ac19c5c2b66a12f5598792aad15114ee3eb62e2Timo Sirainen コンテナ 'foo' が開始され、いくつか処理を行い、終了した場合、出力は以下のようになります。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen 'foo' changed state to [STARTING]
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen 'foo' changed state to [RUNNING]
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen 'foo' changed state to [STOPPING]
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen 'foo' changed state to [STOPPED]
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <para>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <!--
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <command>lxc-wait</command> command will wait for a specific
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen state change and exit. This is useful for scripting to
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen synchronize the launch of a container or the end. The
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen parameter is an ORed combination of different states. The
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen following example shows how to wait for a container if he went
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen to the background.
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen<![CDATA[
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen # launch lxc-wait in background
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen lxc-wait -n foo -s STOPPED &
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen LXC_WAIT_PID=$!
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen # this command goes in background
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen lxc-execute -n foo mydaemon &
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen # block until the lxc-wait exits
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen # and lxc-wait exits when the container
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen # is STOPPED
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen wait $LXC_WAIT_PID
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen echo "'foo' is finished"
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen]]>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen </programlisting>
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen -->
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <command>lxc-wait</command> コマンドは指定した状態を待って、終了します。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen これは、コンテナの開始や終了に同期したいスクリプトで役に立ちます。
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen パラメータは、異なった状態の論理和 (OR) を指定します。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen 以下の例は、バックグラウンドで実行されたコンテナをどのようにして待つかを示します。
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen
6c2c5f20760b06bfb4a40b0ee2ef5ab016bc41f0Timo Sirainen <programlisting>
9672bb2a11c37c275d695451accd824da5c9e485Timo Sirainen<![CDATA[
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen # launch lxc-wait in background
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen lxc-wait -n foo -s STOPPED &
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen LXC_WAIT_PID=$!
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
9672bb2a11c37c275d695451accd824da5c9e485Timo Sirainen # this command goes in background
9672bb2a11c37c275d695451accd824da5c9e485Timo Sirainen lxc-execute -n foo mydaemon &
9672bb2a11c37c275d695451accd824da5c9e485Timo Sirainen
9672bb2a11c37c275d695451accd824da5c9e485Timo Sirainen # block until the lxc-wait exits
9672bb2a11c37c275d695451accd824da5c9e485Timo Sirainen # and lxc-wait exits when the container
9672bb2a11c37c275d695451accd824da5c9e485Timo Sirainen # is STOPPED
9672bb2a11c37c275d695451accd824da5c9e485Timo Sirainen wait $LXC_WAIT_PID
9672bb2a11c37c275d695451accd824da5c9e485Timo Sirainen echo "'foo' is finished"
9672bb2a11c37c275d695451accd824da5c9e485Timo Sirainen]]>
9672bb2a11c37c275d695451accd824da5c9e485Timo Sirainen </programlisting>
9672bb2a11c37c275d695451accd824da5c9e485Timo Sirainen </para>
9672bb2a11c37c275d695451accd824da5c9e485Timo Sirainen </refsect2>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen <refsect2>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen <title><!-- Setting the control group for container -->
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen コンテナの control group の設定
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen </title>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen <para>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen <!--
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen The container is tied with the control groups, when a
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen container is started a control group is created and associated
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen with it. The control group properties can be read and modified
9c2b0eb659540b9db8dd3a8a6a2515921fbe8eebTimo Sirainen when the container is running by using the lxc-cgroup command.
892b3cbf0eba9ba455448adcf71864a409345c6dTimo Sirainen -->
892b3cbf0eba9ba455448adcf71864a409345c6dTimo Sirainen コンテナは control group と結合しています。
892b3cbf0eba9ba455448adcf71864a409345c6dTimo Sirainen コンテナが開始すると control group が生成され、それと結びつけられます。
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen control group のプロパティは、lxc-cgroup コマンドを使って、コンテナが実行中に読み取ったり、変更したりすることができます。
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen </para>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen <para>
9c2b0eb659540b9db8dd3a8a6a2515921fbe8eebTimo Sirainen <!--
9c2b0eb659540b9db8dd3a8a6a2515921fbe8eebTimo Sirainen <command>lxc-cgroup</command> command is used to set or get a
9c2b0eb659540b9db8dd3a8a6a2515921fbe8eebTimo Sirainen control group subsystem which is associated with a
9c2b0eb659540b9db8dd3a8a6a2515921fbe8eebTimo Sirainen container. The subsystem name is handled by the user, the
9c2b0eb659540b9db8dd3a8a6a2515921fbe8eebTimo Sirainen command won't do any syntax checking on the subsystem name, if
9c2b0eb659540b9db8dd3a8a6a2515921fbe8eebTimo Sirainen the subsystem name does not exists, the command will fail.
9c2b0eb659540b9db8dd3a8a6a2515921fbe8eebTimo Sirainen -->
892b3cbf0eba9ba455448adcf71864a409345c6dTimo Sirainen <command>lxc-cgroup</command> コマンドは、コンテナと結びつけられている control group サブシステムを設定したり、取得したりするのに使います。
9c2b0eb659540b9db8dd3a8a6a2515921fbe8eebTimo Sirainen サブシステム名の指定はユーザが行ない、このコマンドはサブシステム名の文法チェックは一切行ないません。
9c2b0eb659540b9db8dd3a8a6a2515921fbe8eebTimo Sirainen もし、指定したサブシステム名が存在しない場合は、コマンドの実行は失敗します。
9c2b0eb659540b9db8dd3a8a6a2515921fbe8eebTimo Sirainen </para>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen <para>
bfdf0fd7b6186f64cbdcbf1cb2bf9c42a9007b77Timo Sirainen <!--
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen <programlisting>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen lxc-cgroup -n foo cpuset.cpus
bfdf0fd7b6186f64cbdcbf1cb2bf9c42a9007b77Timo Sirainen </programlisting>
bfdf0fd7b6186f64cbdcbf1cb2bf9c42a9007b77Timo Sirainen will display the content of this subsystem.
bfdf0fd7b6186f64cbdcbf1cb2bf9c42a9007b77Timo Sirainen <programlisting>
bfdf0fd7b6186f64cbdcbf1cb2bf9c42a9007b77Timo Sirainen lxc-cgroup -n foo cpu.shares 512
bfdf0fd7b6186f64cbdcbf1cb2bf9c42a9007b77Timo Sirainen </programlisting>
bfdf0fd7b6186f64cbdcbf1cb2bf9c42a9007b77Timo Sirainen will set the subsystem to the specified value.
bfdf0fd7b6186f64cbdcbf1cb2bf9c42a9007b77Timo Sirainen -->
bfdf0fd7b6186f64cbdcbf1cb2bf9c42a9007b77Timo Sirainen <programlisting>
bfdf0fd7b6186f64cbdcbf1cb2bf9c42a9007b77Timo Sirainen lxc-cgroup -n foo cpuset.cpus
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen </programlisting>
bfdf0fd7b6186f64cbdcbf1cb2bf9c42a9007b77Timo Sirainen は、このサブシステムの内容を表示します。
bfdf0fd7b6186f64cbdcbf1cb2bf9c42a9007b77Timo Sirainen <programlisting>
bfdf0fd7b6186f64cbdcbf1cb2bf9c42a9007b77Timo Sirainen lxc-cgroup -n foo cpu.shares 512
bfdf0fd7b6186f64cbdcbf1cb2bf9c42a9007b77Timo Sirainen </programlisting>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen は、このサブシステムに指定した値を設定します。
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen </para>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen </refsect2>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen </refsect1>
892b3cbf0eba9ba455448adcf71864a409345c6dTimo Sirainen
892b3cbf0eba9ba455448adcf71864a409345c6dTimo Sirainen <refsect1>
892b3cbf0eba9ba455448adcf71864a409345c6dTimo Sirainen <title><!-- Bugs -->バグ</title>
892b3cbf0eba9ba455448adcf71864a409345c6dTimo Sirainen <para>
bfdf0fd7b6186f64cbdcbf1cb2bf9c42a9007b77Timo Sirainen <!--
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen The <command>lxc</command> is still in development, so the
892b3cbf0eba9ba455448adcf71864a409345c6dTimo Sirainen command syntax and the API can change. The version 1.0.0 will be
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen the frozen version.
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen -->
892b3cbf0eba9ba455448adcf71864a409345c6dTimo Sirainen <command>lxc</command> はまだ開発中です。
892b3cbf0eba9ba455448adcf71864a409345c6dTimo Sirainen 従って、コマンドの文法や API は変更される可能性があります。
892b3cbf0eba9ba455448adcf71864a409345c6dTimo Sirainen バージョン 1.0.0 がそれらを凍結するバージョンとなるでしょう。
892b3cbf0eba9ba455448adcf71864a409345c6dTimo Sirainen </para>
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen </refsect1>
bfdf0fd7b6186f64cbdcbf1cb2bf9c42a9007b77Timo Sirainen
bfdf0fd7b6186f64cbdcbf1cb2bf9c42a9007b77Timo Sirainen &seealso;
6b2738c39a868ff9291867138c55029fc40cf105Timo Sirainen
892b3cbf0eba9ba455448adcf71864a409345c6dTimo Sirainen <refsect1>
892b3cbf0eba9ba455448adcf71864a409345c6dTimo Sirainen <title><!-- Author -->作者</title>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen <para>Daniel Lezcano <email>daniel.lezcano@free.fr</email></para>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen </refsect1>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen</refentry>
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainen<!-- Keep this comment at the end of the file Local variables: mode:
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainensgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainensgml-always-quote-attributes:t sgml-indent-step:2 sgml-indent-data:t
dc9de21d4375faeedbe5b7e941502ac578650da9Timo Sirainensgml-parent-document:nil sgml-default-dtd-file:nil
f4c0b1874b0533bcf2df1d28d584ff02cfdae3faTimo Sirainensgml-exposed-tags:nil sgml-local-catalogs:nil
f4c0b1874b0533bcf2df1d28d584ff02cfdae3faTimo Sirainensgml-local-ecat-files:nil End: -->
f4c0b1874b0533bcf2df1d28d584ff02cfdae3faTimo Sirainen