]> git.proxmox.com Git - mirror_lxc.git/blob - doc/ja/lxc.sgml.in
confile: rename lxc.limit to lxc.prlimit
[mirror_lxc.git] / doc / ja / lxc.sgml.in
1 <!--
2
3 lxc: linux Container library
4
5 (C) Copyright IBM Corp. 2007, 2008
6
7 Authors:
8 Daniel Lezcano <daniel.lezcano at free.fr>
9
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
14
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public
21 License along with this library; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23
24 Translated into Japanese
25 by KATOH Yasufumi <karma at jazz.email.ne.jp>
26
27 -->
28
29 <!DOCTYPE refentry PUBLIC @docdtd@ [
30
31 <!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
32 ]>
33
34 <refentry>
35
36 <docinfo>
37 <date>@LXC_GENERATE_DATE@</date>
38 </docinfo>
39
40
41 <refmeta>
42 <refentrytitle>lxc</refentrytitle>
43 <manvolnum>7</manvolnum>
44 <refmiscinfo>
45 Version @PACKAGE_VERSION@
46 </refmiscinfo>
47 </refmeta>
48
49 <refnamediv>
50 <refname>lxc</refname>
51
52 <refpurpose>
53 <!--
54 linux containers
55 -->
56 Linux コンテナ
57 </refpurpose>
58 </refnamediv>
59
60 <refsect1>
61 <title><!-- Quick start -->クイックスタート</title>
62 <para>
63 <!--
64 You are in a hurry, and you don't want to read this man page. Ok,
65 without warranty, here are the commands to launch a shell inside
66 a container with a predefined configuration template, it may
67 work.
68 <command>@BINDIR@/lxc-execute -n foo -f
69 @DOCDIR@/examples/lxc-macvlan.conf /bin/bash</command>
70 -->
71 急いでいて、この man ページすら読みたくないという場合は、いいでしょう、
72 保証はないですが、あらかじめ準備されている設定テンプレートを使ったコンテナ内でシェルを動かすためのコマンドを紹介しましょう。
73 <command>@BINDIR@/lxc-execute -n foo -f
74 @DOCDIR@/examples/lxc-macvlan.conf /bin/bash</command>
75 </para>
76 </refsect1>
77
78 <refsect1>
79 <title><!-- Overview -->概要</title>
80 <para>
81 <!--
82 The container technology is actively being pushed into the
83 mainstream linux kernel. It provides the resource management
84 through the control groups aka process containers and resource
85 isolation through the namespaces.
86 -->
87 コンテナ技術は、メインストリームの linux kernel で活発に開発が進んでいる技術です。
88 コンテナ技術は、process container という名前でも知られる control groups の機能を使って、リソース管理を提供し、名前空間を使って、リソースの隔離を提供します。
89 </para>
90
91 <para>
92 <!--
93 The linux containers, <command>lxc</command>, aims to use these
94 new functionalities to provide a userspace container object
95 which provides full resource isolation and resource control for
96 an applications or a system.
97 -->
98 linux コンテナ (<command>lxc</command>) は、ユーザースペースのコンテナオブジェクトを提供するための新しい機能を使う事を目指しています。
99 この新しい機能とは、アプリケーションやシステムでの利用を目的とした、完全なリソースの隔離やリソースコントロールを提供する機能です。
100 </para>
101
102 <para>
103 <!--
104 The first objective of this project is to make the life easier
105 for the kernel developers involved in the containers project and
106 especially to continue working on the Checkpoint/Restart new
107 features. The <command>lxc</command> is small enough to easily
108 manage a container with simple command lines and complete enough
109 to be used for other purposes.
110 -->
111 このプロジェクトの第一の目的は、コンテナプロジェクトに参加するカーネル開発者の作業を快適にすることと、特に新機能である Checkpoint/Restart 機能への取り組みを続ける事です。
112 <command>lxc</command> コマンドは、シンプルなコマンドでコンテナの管理を簡単に行えるように小さく、他の目的のために使うのに充分な機能を持っています。
113 </para>
114 </refsect1>
115
116 <refsect1>
117 <title><!-- Requirements -->必要条件</title>
118 <para>
119 <!--
120 The <command>lxc</command> relies on a set of functionalities
121 provided by the kernel which needs to be active. Depending of
122 the missing functionalities the <command>lxc</command> will
123 work with a restricted number of functionalities or will simply
124 fail.
125 -->
126 <command>lxc</command> は、カーネルが提供するいくつかの機能に依存しており、その機能がアクティブになっている必要があります。
127 機能が足りない場合は、<command>lxc</command> は、いくつかの機能が制限されるか、単純に動作が失敗します。
128 </para>
129
130 <para>
131 <!--
132 The following list gives the kernel features to be enabled in
133 the kernel to have the full features container:
134 -->
135 以下のリストは、コンテナの全機能を有効にするために、カーネルで有効にする必要のある機能の一覧です。
136 </para>
137 <programlisting>
138 * General setup
139 * Control Group support
140 -> Namespace cgroup subsystem
141 -> Freezer cgroup subsystem
142 -> Cpuset support
143 -> Simple CPU accounting cgroup subsystem
144 -> Resource counters
145 -> Memory resource controllers for Control Groups
146 * Group CPU scheduler
147 -> Basis for grouping tasks (Control Groups)
148 * Namespaces support
149 -> UTS namespace
150 -> IPC namespace
151 -> User namespace
152 -> Pid namespace
153 -> Network namespace
154 * Device Drivers
155 * Character devices
156 -> Support multiple instances of devpts
157 * Network device support
158 -> MAC-VLAN support
159 -> Virtual ethernet pair device
160 * Networking
161 * Networking options
162 -> 802.1d Ethernet Bridging
163 * Security options
164 -> File POSIX Capabilities
165 </programlisting>
166
167 <para>
168 <!--
169 The kernel version >= 2.6.32 shipped with the distros, will
170 work with <command>lxc</command>, this one will have less
171 functionalities but enough to be interesting.
172
173 The helper script <command>lxc-checkconfig</command> will give
174 you information about your kernel configuration.
175 -->
176 2.6.32 以上のバージョンが採用されているディストリビューションならば、<command>lxc</command> は動作するでしょう。
177 機能的には若干少ない形ですが、充分に楽しめるはずです。
178 ヘルパースクリプトの <command>lxc-checkconfig</command> を使って、あなたのカーネルの設定に関する情報を取得できるでしょう。
179 </para>
180
181 <para>
182 <!--
183 The control group can be mounted anywhere, eg:
184 <command>mount -t cgroup cgroup /cgroup</command>.
185
186 It is however recommended to use cgmanager, cgroup-lite or systemd
187 to mount the cgroup hierarchy under /sys/fs/cgroup.
188 -->
189 control group は、どこにでもマウント可能です。
190 例えば、<command>mount -t cgroup cgroup /cgroup</command> のようにです。
191
192 しかし、cgroup の階層構造を /sys/fs/cgroup 以下にマウントするために cgmanager や cgroup-lite や systemd の使用が推奨されています。
193 </para>
194
195 </refsect1>
196
197 <refsect1>
198 <title><!-- Functional specification -->機能仕様</title>
199 <para>
200 <!--
201 A container is an object isolating some resources of the host,
202 for the application or system running in it.
203 -->
204 コンテナは、コンテナ内で実行されているシステムやアプリケーションに対するホストのリソースのいくつかが、隔離されているオブジェクトです。
205 </para>
206 <para>
207 <!--
208 The application / system will be launched inside a
209 container specified by a configuration that is either
210 initially created or passed as parameter of the starting
211 commands.
212 -->
213 アプリケーション/システムは、あらかじめ作成された設定もしくは開始コマンドのパラメータで指定された設定で、コンテナ内で実行されます。
214 </para>
215
216 <para>
217 <!--
218 How to run an application in a container ?
219 -->
220 どうやってコンテナ内でアプリケーションを実行するのでしょう?
221 </para>
222 <para>
223 <!--
224 Before running an application, you should know what are the
225 resources you want to isolate. The default configuration is to
226 isolate the pids, the sysv ipc and the mount points. If you want
227 to run a simple shell inside a container, a basic configuration
228 is needed, especially if you want to share the rootfs. If you
229 want to run an application like <command>sshd</command>, you
230 should provide a new network stack and a new hostname. If you
231 want to avoid conflicts with some files
232 eg. <filename>/var/run/httpd.pid</filename>, you should
233 remount <filename>/var/run</filename> with an empty
234 directory. If you want to avoid the conflicts in all the cases,
235 you can specify a rootfs for the container. The rootfs can be a
236 directory tree, previously bind mounted with the initial rootfs,
237 so you can still use your distro but with your
238 own <filename>/etc</filename> and <filename>/home</filename>
239 -->
240 アプリケーションを実行する前に、隔離したいリソースについて知っておくべきです。
241 デフォルトの設定では、pid、sysv ipc、マウントポイントが隔離されます。
242 コンテナ内でシンプルなシェルを実行したい場合で、特に rootfs を共有したい場合、基本的な設定が必要です。
243 もし、<command>sshd</command> のようなアプリケーションを実行したい場合、新しいネットワークスタックと、新しいホスト名を準備しなくてはなりません。
244 もし、同じファイル (<filename>/var/run/httpd.pid</filename> 等) の衝突を避けたい場合、空の <filename>/var/run/</filename> を再度マウントしなければなりません。
245 どんな場合でも、衝突を避けたい場合、コンテナ専用の rootfs を指定することができます。
246 rootfs はディレクトリツリーとなる事も可能で、前もって元の rootfs を bind マウントし、しかし、自身の <filename>/etc</filename> や <filename>/home</filename>を使って。自身のディストリビューションを使うことが可能です。
247 </para>
248 <para>
249 <!--
250 Here is an example of directory tree
251 for <command>sshd</command>:
252 <programlisting>
253 [root@lxc sshd]$ tree -d rootfs
254
255 rootfs
256 |&#045;&#045; bin
257 |&#045;&#045; dev
258 | |&#045;&#045; pts
259 | `&#045;&#045; shm
260 | `&#045;&#045; network
261 |&#045;&#045; etc
262 | `&#045;&#045; ssh
263 |&#045;&#045; lib
264 |&#045;&#045; proc
265 |&#045;&#045; root
266 |&#045;&#045; sbin
267 |&#045;&#045; sys
268 |&#045;&#045; usr
269 `&#045;&#045; var
270 |&#045;&#045; empty
271 | `&#045;&#045; sshd
272 |&#045;&#045; lib
273 | `&#045;&#045; empty
274 | `&#045;&#045; sshd
275 `&#045;&#045; run
276 `&#045;&#045; sshd
277 </programlisting>
278
279 and the mount points file associated with it:
280 <programlisting>
281 [root@lxc sshd]$ cat fstab
282
283 /lib /home/root/sshd/rootfs/lib none ro,bind 0 0
284 /bin /home/root/sshd/rootfs/bin none ro,bind 0 0
285 /usr /home/root/sshd/rootfs/usr none ro,bind 0 0
286 /sbin /home/root/sshd/rootfs/sbin none ro,bind 0 0
287 </programlisting>
288 -->
289 ここで、<command>sshd</command> のためのディレクトリツリーのサンプルを示しましょう。
290 <programlisting>
291 [root@lxc sshd]$ tree -d rootfs
292
293 rootfs
294 |-- bin
295 |-- dev
296 | |-- pts
297 | `-- shm
298 | `-- network
299 |-- etc
300 | `-- ssh
301 |-- lib
302 |-- proc
303 |-- root
304 |-- sbin
305 |-- sys
306 |-- usr
307 `-- var
308 |-- empty
309 | `-- sshd
310 |-- lib
311 | `-- empty
312 | `-- sshd
313 `-- run
314 `-- sshd
315 </programlisting>
316
317 そして、それに対応するマウントポイントのファイルは以下のようになります。
318 <programlisting>
319 [root@lxc sshd]$ cat fstab
320
321 /lib /home/root/sshd/rootfs/lib none ro,bind 0 0
322 /bin /home/root/sshd/rootfs/bin none ro,bind 0 0
323 /usr /home/root/sshd/rootfs/usr none ro,bind 0 0
324 /sbin /home/root/sshd/rootfs/sbin none ro,bind 0 0
325 </programlisting>
326 </para>
327
328 <para>
329 <!--
330 How to run a system in a container ?
331 -->
332 コンテナ内でシステムを実行する方法は?
333 </para>
334
335 <para>
336 <!--
337 Running a system inside a container is paradoxically easier
338 than running an application. Why ? Because you don't have to care
339 about the resources to be isolated, everything need to be
340 isolated, the other resources are specified as being isolated but
341 without configuration because the container will set them
342 up. eg. the ipv4 address will be setup by the system container
343 init scripts. Here is an example of the mount points file:
344
345 <programlisting>
346 [root@lxc debian]$ cat fstab
347
348 /dev /home/root/debian/rootfs/dev none bind 0 0
349 /dev/pts /home/root/debian/rootfs/dev/pts none bind 0 0
350 </programlisting>
351
352 More information can be added to the container to facilitate the
353 configuration. For example, make accessible from the container
354 the resolv.conf file belonging to the host.
355
356 <programlisting>
357 /etc/resolv.conf /home/root/debian/rootfs/etc/resolv.conf none bind 0 0
358 </programlisting>
359 -->
360 コンテナ内でシステムを実行するのは、逆説的ではありますが、アプリケーションを実行するよりも簡単です。
361 それは、隔離するリソースについて考える必要がないからで、全てを隔離する必要があるからです。
362 他のリソースは、コンテナが設定を行うので、設定なしで隔離されるように指定されます。
363 例えば、IPv4 アドレスはコンテナの init スクリプトでシステムによってセットアップされるでしょう。
364 以下に、(システムを実行するときの) マウントポイントファイルを示します。
365
366 <programlisting>
367 [root@lxc debian]$ cat fstab
368
369 /dev /home/root/debian/rootfs/dev none bind 0 0
370 /dev/pts /home/root/debian/rootfs/dev/pts none bind 0 0
371 </programlisting>
372
373 設定を手助けするために、コンテナに更なる情報を追加することも可能です。
374 例えば、ホスト上に存在する resolv.conf ファイルをコンテナからアクセス可能にするには、以下のようにします。
375
376 <programlisting>
377 /etc/resolv.conf /home/root/debian/rootfs/etc/resolv.conf none bind 0 0
378 </programlisting>
379 </para>
380
381 <refsect2>
382 <title><!-- Container life cycle -->コンテナのライフサイクル</title>
383 <para>
384 <!--
385 When the container is created, it contains the configuration
386 information. When a process is launched, the container will be
387 starting and running. When the last process running inside the
388 container exits, the container is stopped.
389 -->
390 コンテナが作成されるとき、コンテナは設定情報を含みます。
391 プロセスが生成されるとき、コンテナは開始し、実行されるでしょう。
392 コンテナ内で実行されている最後のプロセスが終了したとき、コンテナは停止します。
393 </para>
394 <para>
395 <!--
396 In case of failure when the container is initialized, it will
397 pass through the aborting state.
398 -->
399 コンテナの初期化時の失敗の場合は、(以下の図の) 中断の状態を通ります。
400 </para>
401
402 <programlisting>
403 <![CDATA[
404 ---------
405 | STOPPED |<---------------
406 --------- |
407 | |
408 start |
409 | |
410 V |
411 ---------- |
412 | STARTING |--error- |
413 ---------- | |
414 | | |
415 V V |
416 --------- ---------- |
417 | RUNNING | | ABORTING | |
418 --------- ---------- |
419 | | |
420 no process | |
421 | | |
422 V | |
423 ---------- | |
424 | STOPPING |<------- |
425 ---------- |
426 | |
427 ---------------------
428 ]]>
429 </programlisting>
430 </refsect2>
431
432 <refsect2>
433 <title><!-- Configuration -->設定</title>
434 <para>
435 <!--
436 The container is configured through a configuration
437 file, the format of the configuration file is described in
438 <citerefentry>
439 <refentrytitle><filename>lxc.conf</filename></refentrytitle>
440 <manvolnum>5</manvolnum>
441 </citerefentry>
442 -->
443 </para>
444 コンテナは設定ファイル経由で設定します。設定の書式は以下で説明しています。
445 <citerefentry>
446 <refentrytitle><filename>lxc.conf</filename></refentrytitle>
447 <manvolnum>5</manvolnum>
448 </citerefentry>
449 </refsect2>
450
451 <refsect2>
452 <title><!--Creating / Destroying container
453 (persistent container) -->コンテナの生成と終了 (持続性のコンテナ)</title>
454 <para>
455 <!--
456 A persistent container object can be
457 created via the <command>lxc-create</command>
458 command. It takes a container name as parameter and
459 optional configuration file and template.
460 The name is used by the different
461 commands to refer to this
462 container. The <command>lxc-destroy</command> command will
463 destroy the container object.
464 <programlisting>
465 lxc-create -n foo
466 lxc-destroy -n foo
467 </programlisting>
468 -->
469 持続性のコンテナオブジェクトは <command>lxc-create</command> コマンドで作成することができます。
470 コマンドにはコンテナ名をパラメータとして、オプションで設定ファイルとテンプレートを指定します。
471 ここで指定する名前は、他のコマンドからこのコンテナを参照する際に使います。
472 <command>lxc-destroy</command> コマンドはコンテナオブジェクトを破壊します。
473 <programlisting>
474 lxc-create -n foo
475 lxc-destroy -n foo
476 </programlisting>
477 </para>
478 </refsect2>
479
480 <refsect2>
481 <title><!-- Volatile container -->揮発性のコンテナ</title>
482 <para>
483 <!--
484 It is not mandatory to create a container object
485 before to start it.
486 The container can be directly started with a
487 configuration file as parameter.
488 -->
489 コンテナを開始する前にコンテナオブジェクトを作成する必要はありません。
490 コンテナを設定ファイルのパラメータで指定して直接開始することができます。
491 </para>
492 </refsect2>
493
494 <refsect2>
495 <title><!-- Starting / Stopping container -->コンテナの開始と終了</title>
496 <para>
497 <!--
498 When the container has been created, it is ready to run an
499 application / system.
500 This is the purpose of the <command>lxc-execute</command> and
501 <command>lxc-start</command> commands.
502 If the container was not created before
503 starting the application, the container will use the
504 configuration file passed as parameter to the command,
505 and if there is no such parameter either, then
506 it will use a default isolation.
507 If the application is ended, the container will be stopped also,
508 but if needed the <command>lxc-stop</command> command can
509 be used to kill the still running application.
510 -->
511 コンテナが作成されると、アプリケーションもしくはシステムとして実行することができます。
512 このために使用するのが <command>lxc-execute</command> と <command>lxc-start</command> コマンドです。
513 アプリケーションが開始する前にコンテナが作成されなかった場合、コンテナはコマンドへ与えるパラメータを取得するのに設定ファイルを使うでしょう。
514 もし、このようなパラメータもない場合は、デフォルトで指定されている通りに隔離されます。
515 アプリケーションが終了した場合、コンテナも停止しますが、実行中のアプリケーションを停止するには <command>lxc-stop</command> を使用する必要があります。
516 </para>
517
518 <para>
519 <!--
520 Running an application inside a container is not exactly the
521 same thing as running a system. For this reason, there are two
522 different commands to run an application into a container:
523 <programlisting>
524 lxc-execute -n foo [-f config] /bin/bash
525 lxc-start -n foo [-f config] [/bin/bash]
526 </programlisting>
527 -->
528 コンテナ内のアプリケーションの実行は、正確にはシステムとして実行するのとは異なります。
529 そのような理由で、コンテナ内でアプリケーションを実行するためのコマンドには、2 種類の違ったものがあります。
530 <programlisting>
531 lxc-execute -n foo [-f config] /bin/bash
532 lxc-start -n foo [-f config] [/bin/bash]
533 </programlisting>
534 </para>
535
536 <para>
537 <!--
538 <command>lxc-execute</command> command will run the
539 specified command into the container via an intermediate
540 process, <command>lxc-init</command>.
541 This lxc-init after launching the specified command,
542 will wait for its end and all other reparented processes.
543 (to support daemons in the container).
544 In other words, in the
545 container, <command>lxc-init</command> has the pid 1 and the
546 first process of the application has the pid 2.
547 -->
548 <command>lxc-execute</command> コマンドは、<command>lxc-init</command> プロセス経由で、コンテナ内で特定のコマンドを実行します。
549 lxc-init はコマンドを実行した後、(コンテナ内でのデーモンの実行をサポートするために) 実行したコマンドと生成された全てのプロセスが終了するのを待ちます。
550 言いかえると、コンテナ内では <command>lxc-init</command> は pid 1 を持ち、アプリケーションの最初のプロセスは pid 2 をもちます。
551 </para>
552
553 <para>
554 <!--
555 <command>lxc-start</command> command will run directly the specified
556 command into the container.
557 The pid of the first process is 1. If no command is
558 specified <command>lxc-start</command> will
559 run the command defined in lxc.init_cmd or if not set,
560 <filename>/sbin/init</filename> .
561 -->
562 <command>lxc-start</command> コマンドは、コンテナ内の特定のコマンドを直接実行します。
563 最初のプロセスの pid が 1 となります。
564 もし、実行するコマンドが指定されない場合は、<command>lxc-start</command> は lxc.init_cmd で設定されたコマンドを実行します。もし lxc.init_cmd が設定されていない場合は <filename>/sbin/init</filename> を実行します。
565 </para>
566
567 <para>
568 <!--
569 To summarize, <command>lxc-execute</command> is for running
570 an application and <command>lxc-start</command> is better suited for
571 running a system.
572 -->
573 まとめると、<command>lxc-execute</command> はアプリケーションを実行するためのコマンドであり、<command>lxc-start</command> はシステムを実行するのにより適したコマンドです。
574 </para>
575
576 <para>
577 <!--
578 If the application is no longer responding, is inaccessible or is
579 not able to finish by itself, a
580 wild <command>lxc-stop</command> command will kill all the
581 processes in the container without pity.
582 <programlisting>
583 lxc-stop -n foo
584 </programlisting>
585 -->
586 もしアプリケーションの反応がなくなった場合や、アクセスできなくなった場合、自分で終了することができない場合は、荒っぽいですが、<command>lxc-stop</command> コマンドがコンテナ内の全てのプロセスを容赦なく停止させてくれるでしょう。
587 </para>
588 </refsect2>
589
590 <refsect2>
591 <title><!-- Connect to an available tty -->利用可能な tty への接続</title>
592 <para>
593 <!--
594 If the container is configured with the ttys, it is possible
595 to access it through them. It is up to the container to
596 provide a set of available tty to be used by the following
597 command. When the tty is lost, it is possible to reconnect it
598 without login again.
599 <programlisting>
600 lxc-console -n foo -t 3
601 </programlisting>
602 -->
603 コンテナが tty を持つように設定されているならば、tty を通してコンテナにアクセスすることができます。
604 それは以下のコマンドが使う tty がコンテナで利用可能に設定されているか次第です。
605 tty が失われたとき、再度のログインなしでその tty に再接続することが可能です。
606 <programlisting>
607 lxc-console -n foo -t 3
608 </programlisting>
609 </para>
610 </refsect2>
611
612 <refsect2>
613 <title><!-- Freeze / Unfreeze container -->コンテナの凍結と解凍</title>
614 <para>
615 <!--
616 Sometime, it is useful to stop all the processes belonging to
617 a container, eg. for job scheduling. The commands:
618 <programlisting>
619 lxc-freeze -n foo
620 </programlisting>
621
622 will put all the processes in an uninteruptible state and
623
624 <programlisting>
625 lxc-unfreeze -n foo
626 </programlisting>
627
628 will resume them.
629 -->
630 ジョブスケジューリングなどで、コンテナに属する全てのプロセスを停止する事が役に立つときがあります。
631 コマンド
632 <programlisting>
633 lxc-freeze -n foo
634 </programlisting>
635 は、全てのプロセスを中断不可能な状態に置きます。そして、
636
637 <programlisting>
638 lxc-unfreeze -n foo
639 </programlisting>
640
641 その全てのプロセスを再開します。
642 </para>
643
644 <para>
645 <!--
646 This feature is enabled if the cgroup freezer is enabled in the
647 kernel.
648 -->
649 この機能は、カーネルで cgroup freezer 機能が有効になっている場合に使用可能です。
650 </para>
651 </refsect2>
652
653 <refsect2>
654 <title><!-- Getting information about container -->
655 コンテナに関する情報の取得</title>
656 <para>
657 <!--
658 When there are a lot of containers, it is hard to follow
659 what has been created or destroyed, what is running or what are
660 the pids running into a specific container. For this reason, the
661 following commands may be useful:
662 <programlisting>
663 lxc-ls
664 lxc-info -n foo
665 </programlisting>
666 -->
667 多数のコンテナが存在する場合、それらが実行されたり破壊されたりすること、何が実行されていて、特定のコンテナ内で実行されている pid が何であるかをフォローするのは大変です。
668 このような時には、以下のようなコマンドが役に立つかもしれません。
669 <programlisting>
670 lxc-ls
671 lxc-info -n foo
672 </programlisting>
673 </para>
674 <para>
675 <!--
676 <command>lxc-ls</command> lists the containers of the
677 system.
678 -->
679 <command>lxc-ls</command> は、システムのコンテナを一覧します。
680 </para>
681
682 <para>
683 <!--
684 <command>lxc-info</command> gives information for a specific
685 container.
686 -->
687 <command>lxc-info</command> は、指定したコンテナに関する情報を取得します。
688 </para>
689
690 <para>
691 <!--
692 Here is an example on how the combination of these commands
693 allows one to list all the containers and retrieve their state.
694 <programlisting>
695 for i in $(lxc-ls -1); do
696 lxc-info -n $i
697 done
698 </programlisting>
699 -->
700 ここで、以上のコマンドを組み合わせて、どのようにしたら全てのコンテナのリストと、それぞれの状態が得られるかの例を示します。
701 <programlisting>
702 for i in $(lxc-ls -1); do
703 lxc-info -n $i
704 done
705 </programlisting>
706 </para>
707
708 </refsect2>
709
710 <refsect2>
711 <title><!-- Monitoring container -->コンテナのモニタリング</title>
712 <para>
713 <!--
714 It is sometime useful to track the states of a container,
715 for example to monitor it or just to wait for a specific
716 state in a script.
717 -->
718 時々、コンテナの状態を追跡することが出来ると便利な事があります。
719 例えば、状態をモニタリングしたり、スクリプト内で特定の状態を待ったりするような場合です。
720 </para>
721
722 <para>
723 <!--
724 <command>lxc-monitor</command> command will monitor one or
725 several containers. The parameter of this command accept a
726 regular expression for example:
727 <programlisting>
728 lxc-monitor -n "foo|bar"
729 </programlisting>
730 will monitor the states of containers named 'foo' and 'bar', and:
731 <programlisting>
732 lxc-monitor -n ".*"
733 </programlisting>
734 will monitor all the containers.
735 -->
736 <command>lxc-monitor</command> コマンドは、一つもしくはいくつかのコンテナをモニタリングします。
737 このコマンドのパラメータは、正規表現を受け付けます。例えば
738 <programlisting>
739 lxc-monitor -n "foo|bar"
740 </programlisting>
741 は 'foo' と 'bar' という名前のコンテナの状態をモニタリングします。そして、
742 <programlisting>
743 lxc-monitor -n ".*"
744 </programlisting>
745 は全てのコンテナの状態をモニタリングします。
746 </para>
747 <para>
748 <!--
749 For a container 'foo' starting, doing some work and exiting,
750 the output will be in the form:
751 <programlisting>
752 'foo' changed state to [STARTING]
753 'foo' changed state to [RUNNING]
754 'foo' changed state to [STOPPING]
755 'foo' changed state to [STOPPED]
756 </programlisting>
757 -->
758 コンテナ 'foo' が開始され、いくつか処理を行い、終了した場合、出力は以下のようになります。
759 <programlisting>
760 'foo' changed state to [STARTING]
761 'foo' changed state to [RUNNING]
762 'foo' changed state to [STOPPING]
763 'foo' changed state to [STOPPED]
764 </programlisting>
765 </para>
766 <para>
767 <!--
768 <command>lxc-wait</command> command will wait for a specific
769 state change and exit. This is useful for scripting to
770 synchronize the launch of a container or the end. The
771 parameter is an ORed combination of different states. The
772 following example shows how to wait for a container if he went
773 to the background.
774
775 <programlisting>
776 <![CDATA[
777 # launch lxc-wait in background
778 lxc-wait -n foo -s STOPPED &
779 LXC_WAIT_PID=$!
780
781 # this command goes in background
782 lxc-execute -n foo mydaemon &
783
784 # block until the lxc-wait exits
785 # and lxc-wait exits when the container
786 # is STOPPED
787 wait $LXC_WAIT_PID
788 echo "'foo' is finished"
789 ]]>
790 </programlisting>
791 -->
792 <command>lxc-wait</command> コマンドは指定した状態を待って、終了します。
793 これは、コンテナの開始や終了に同期したいスクリプトで役に立ちます。
794 パラメータは、異なった状態の論理和 (OR) を指定します。
795 以下の例は、バックグラウンドで実行されたコンテナをどのようにして待つかを示します。
796
797 <programlisting>
798 <![CDATA[
799 # launch lxc-wait in background
800 lxc-wait -n foo -s STOPPED &
801 LXC_WAIT_PID=$!
802
803 # this command goes in background
804 lxc-execute -n foo mydaemon &
805
806 # block until the lxc-wait exits
807 # and lxc-wait exits when the container
808 # is STOPPED
809 wait $LXC_WAIT_PID
810 echo "'foo' is finished"
811 ]]>
812 </programlisting>
813 </para>
814 </refsect2>
815
816 <refsect2>
817 <title><!-- Setting the control group for container -->
818 コンテナの control group の設定
819 </title>
820 <para>
821 <!--
822 The container is tied with the control groups, when a
823 container is started a control group is created and associated
824 with it. The control group properties can be read and modified
825 when the container is running by using the lxc-cgroup command.
826 -->
827 コンテナは control group と結合しています。
828 コンテナが開始すると control group が生成され、それと結びつけられます。
829 control group のプロパティは、lxc-cgroup コマンドを使って、コンテナが実行中に読み取ったり、変更したりすることができます。
830 </para>
831 <para>
832 <!--
833 <command>lxc-cgroup</command> command is used to set or get a
834 control group subsystem which is associated with a
835 container. The subsystem name is handled by the user, the
836 command won't do any syntax checking on the subsystem name, if
837 the subsystem name does not exists, the command will fail.
838 -->
839 <command>lxc-cgroup</command> コマンドは、コンテナと結びつけられている control group サブシステムを設定したり、取得したりするのに使います。
840 サブシステム名の指定はユーザが行ない、このコマンドはサブシステム名の文法チェックは一切行ないません。
841 もし、指定したサブシステム名が存在しない場合は、コマンドの実行は失敗します。
842 </para>
843 <para>
844 <!--
845 <programlisting>
846 lxc-cgroup -n foo cpuset.cpus
847 </programlisting>
848 will display the content of this subsystem.
849 <programlisting>
850 lxc-cgroup -n foo cpu.shares 512
851 </programlisting>
852 will set the subsystem to the specified value.
853 -->
854 <programlisting>
855 lxc-cgroup -n foo cpuset.cpus
856 </programlisting>
857 は、このサブシステムの内容を表示します。
858 <programlisting>
859 lxc-cgroup -n foo cpu.shares 512
860 </programlisting>
861 は、このサブシステムに指定した値を設定します。
862 </para>
863 </refsect2>
864 </refsect1>
865
866 <refsect1>
867 <title><!-- Bugs -->バグ</title>
868 <para>
869 <!--
870 The <command>lxc</command> is still in development, so the
871 command syntax and the API can change. The version 1.0.0 will be
872 the frozen version.
873 -->
874 <command>lxc</command> はまだ開発中です。
875 従って、コマンドの文法や API は変更される可能性があります。
876 バージョン 1.0.0 がそれらを凍結するバージョンとなるでしょう。
877 </para>
878 </refsect1>
879
880 &seealso;
881
882 <refsect1>
883 <title><!-- Author -->作者</title>
884 <para>Daniel Lezcano <email>daniel.lezcano@free.fr</email></para>
885 </refsect1>
886
887 </refentry>
888
889 <!-- Keep this comment at the end of the file Local variables: mode:
890 sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil
891 sgml-always-quote-attributes:t sgml-indent-step:2 sgml-indent-data:t
892 sgml-parent-document:nil sgml-default-dtd-file:nil
893 sgml-exposed-tags:nil sgml-local-catalogs:nil
894 sgml-local-ecat-files:nil End: -->