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