lxc.container.conf.sgml.in revision d0b2a43477227f36c1415d1403596d17490fad8a
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenlxc: linux Container library
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen(C) Copyright IBM Corp. 2007, 2008
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo SirainenDaniel Lezcano <daniel.lezcano at free.fr>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo SirainenThis library is free software; you can redistribute it and/or
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenmodify it under the terms of the GNU Lesser General Public
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo SirainenLicense as published by the Free Software Foundation; either
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenversion 2.1 of the License, or (at your option) any later version.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo SirainenThis library is distributed in the hope that it will be useful,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenbut WITHOUT ANY WARRANTY; without even the implied warranty of
de3175adb4094086dc8ba13132a39567f9c42e54Timo SirainenMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
de3175adb4094086dc8ba13132a39567f9c42e54Timo SirainenLesser General Public License for more details.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo SirainenYou should have received a copy of the GNU Lesser General Public
de3175adb4094086dc8ba13132a39567f9c42e54Timo SirainenLicense along with this library; if not, write to the Free Software
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo SirainenFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo SirainenTranslated into Japanese
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenby KATOH Yasufumi <karma at jazz.email.ne.jp>
de3175adb4094086dc8ba13132a39567f9c42e54Timo Sirainen<!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <refentrytitle>lxc.container.conf</refentrytitle>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen LXC container configuration file
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen LXC コンテナ設定ファイル
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen </refpurpose>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen </refnamediv>
3c73d884362b72c86753939551c94f8baa5702f8Timo Sirainen The linux containers (<command>lxc</command>) are always created
3c73d884362b72c86753939551c94f8baa5702f8Timo Sirainen before being used. This creation defines a set of system
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen resources to be virtualized / isolated when a process is using
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen the container. By default, the pids, sysv ipc and mount points
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen are virtualized and isolated. The other system resources are
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen shared across containers, until they are explicitly defined in
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen the configuration file. For example, if there is no network
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen configuration, the network will be shared between the creator of
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen the container and the container itself, but if the network is
9f240e2ce97176146b63506a8ee04034f712cf45Timo Sirainen specified, a new network stack is created for the container and
9f240e2ce97176146b63506a8ee04034f712cf45Timo Sirainen the container can no longer use the network of its ancestor.
9f240e2ce97176146b63506a8ee04034f712cf45Timo Sirainen linux コンテナ (<command>lxc</command>) は、常に使用する前に作成されます。
9f240e2ce97176146b63506a8ee04034f712cf45Timo Sirainen コンテナは、プロセスがコンテナを使う時に仮想化/隔離するシステムリソースのセットを定義することによって作成します。
9f240e2ce97176146b63506a8ee04034f712cf45Timo Sirainen デフォルトでは、pid, sysv ipc, マウントポイントが仮想化され、隔離されます。
9f240e2ce97176146b63506a8ee04034f712cf45Timo Sirainen 他のシステムリソースは、設定ファイルで明確に定義されない限りは、コンテナをまたいで共有されます。
9f240e2ce97176146b63506a8ee04034f712cf45Timo Sirainen 例えば、もしネットワークが設定されていなければ、コンテナを作成する側とコンテナでネットワークを共有します。
9f240e2ce97176146b63506a8ee04034f712cf45Timo Sirainen しかし、ネットワークが指定されれば、新しいネットワークスタックがコンテナ用に作成され、コンテナは作成元の環境のネットワークを使いません。
9f240e2ce97176146b63506a8ee04034f712cf45Timo Sirainen The configuration file defines the different system resources to
9f240e2ce97176146b63506a8ee04034f712cf45Timo Sirainen be assigned for the container. At present, the utsname, the
9f240e2ce97176146b63506a8ee04034f712cf45Timo Sirainen network, the mount points, the root file system, the user namespace,
9f240e2ce97176146b63506a8ee04034f712cf45Timo Sirainen and the control groups are supported.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 設定ファイルは、コンテナに割り当てられる様々なシステムリソースを定義します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 現時点では、utsname、ネットワーク、マウントポイント、root ファイルシステム、ユーザ名前空間、control groups がサポートされます。
c307328f59c963eba21091ecd36c9435d42b47d8Timo Sirainen Each option in the configuration file has the form <command>key
c307328f59c963eba21091ecd36c9435d42b47d8Timo Sirainen = value</command> fitting in one line. The '#' character means
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen the line is a comment.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 設定ファイルのオプション一つを、<command>key = value</command> の形で一行で表します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen '#' は、その行はコメントであることを示します。
c307328f59c963eba21091ecd36c9435d42b47d8Timo Sirainen In order to ease administration of multiple related containers, it
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen is possible to have a container configuration file cause another
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen file to be loaded. For instance, network configuration
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen can be defined in one common file which is included by multiple
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen containers. Then, if the containers are moved to another host,
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen only one file may need to be updated.
55d33f807765482eb47374aaaced1fe714e0b256Timo Sirainen 複数の関係するコンテナの管理を容易にするために、コンテナの設定ファイルに別のファイルをロードすることが可能です。
887a9fbbb2ca6afd53365ba2ccae0ef8728d6948Timo Sirainen 例えば、ネットワークの設定を、複数のコンテナから include させるように 1 つのファイルに定義することが可能です。
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen その場合、コンテナが他のホストに移動すると、そのファイルだけを更新する必要があるかもしれません。
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen <variablelist>
887a9fbbb2ca6afd53365ba2ccae0ef8728d6948Timo Sirainen <varlistentry>
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen Specify the file to be included. The included file must be
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen in the same valid lxc configuration file format.
c7be65f5adbc2990fbe6eeffb6df5054a8a49d9dTimo Sirainen include させたいファイルを指定します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen include するファイルは、lxc 設定ファイルのフォーマットとして有効でなければいけません。
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen </varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen </variablelist>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen Allows one to set the architecture for the container. For example,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen set a 32bits architecture for a container running 32bits
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen binaries on a 64bits host. That fixes the container scripts
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen which rely on the architecture to do some work like
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen downloading the packages.
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen コンテナに対してアーキテクチャを設定することが可能です。
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen 例えば、64 ビットのホスト上で 32 ビットのバイナリを動かすために 32 ビットアーキテクチャを設定することが可能です。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen この設定を行うことにより、パッケージのダウンロードを行うなどの作業のうち、アーキテクチャ名に依存するような作業を行うコンテナスクリプトの修正を行います。
9f240e2ce97176146b63506a8ee04034f712cf45Timo Sirainen <variablelist>
9f240e2ce97176146b63506a8ee04034f712cf45Timo Sirainen <varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen Specify the architecture for the container.
c7be65f5adbc2990fbe6eeffb6df5054a8a49d9dTimo Sirainen コンテナに設定するアーキテクチャを指定します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen Valid options are
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>x86</option>,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>i686</option>,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>x86_64</option>,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>amd64</option>
c7be65f5adbc2990fbe6eeffb6df5054a8a49d9dTimo Sirainen 有効なオプションは以下です。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen </varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen </variablelist>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen The utsname section defines the hostname to be set for the
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen container. That means the container can set its own hostname
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen without changing the one from the system. That makes the
9f240e2ce97176146b63506a8ee04034f712cf45Timo Sirainen hostname private for the container.
9f240e2ce97176146b63506a8ee04034f712cf45Timo Sirainen utsname セクションは、コンテナに設定されるホスト名を定義します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen コンテナは、システムのホスト名を変えることなく、自身のホスト名を持つ事が可能です。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen このことにより、ホスト名はコンテナ専用となります。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <variablelist>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen specify the hostname for the container
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen コンテナのホスト名を指定します。
36723cf206a7b64b9d972ab0719bbfaacc9316faTimo Sirainen </varlistentry>
efeb13303798b47d2c4295468d233c1bcfd79c94Timo Sirainen </variablelist>
14f6fe5d6c4834f273ca573c23c0659a93123363Timo Sirainen <title><!-- Halt signal -->クリーンなシャットダウン時のシグナル</title>
d1e843e77f4760e303c53d9fce10123fc8d230a1Timo Sirainen Allows one to specify signal name or number, sent by lxc-stop to the
d1e843e77f4760e303c53d9fce10123fc8d230a1Timo Sirainen container's init process to cleanly shutdown the container. Different
d1e843e77f4760e303c53d9fce10123fc8d230a1Timo Sirainen init systems could use different signals to perform clean shutdown
14b1d2a2634e75b988078baee1e8ad678de28a04Timo Sirainen sequence. This option allows the signal to be specified in kill(1)
14b1d2a2634e75b988078baee1e8ad678de28a04Timo Sirainen fashion, e.g. SIGPWR, SIGRTMIN+14, SIGRTMAX-10 or plain number. The
45af47783693b3ba2768c5ad34eeff68132382d0Timo Sirainen default signal is SIGPWR.
afd6d387ea65843b59fb6051fb567719d2a5279cAki Tuomi lxc-stop がコンテナをクリーンにシャットダウンするためにコンテナの init プロセスに送るシグナル名か番号を指定できます。
afd6d387ea65843b59fb6051fb567719d2a5279cAki Tuomi init システムによって、クリーンなシャットダウンを行うために使うシグナルは異なります。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen このオプションではシグナルとして kill(1) で使う形式を指定することができます。
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen 例えば SIGKILL, SIGRTMIN+14, SIGRTMAX-10 のような形式、もしくは数字を指定します。デフォルトのシグナルは SIGPWR です。
70df8f39fb3db7c49b18c855178f8172176a037aTimo Sirainen <variablelist>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <varlistentry>
ee8294dbc7bb549557f6ba1264d66b55fbef69b6Aki Tuomi specify the signal used to halt the container
2e652d2651b2800f99a17dcb3014a009fe4660d3Timo Sirainen コンテナをシャットダウンするために使うシグナルを指定します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen </varlistentry>
979d89c147520f2934c14c31aeb9310fd2d62a46Timo Sirainen </variablelist>
979d89c147520f2934c14c31aeb9310fd2d62a46Timo Sirainen <title>リブート時のシグナル <!-- Reboot signal --></title>
70058d29cf8c77501741ddbc39178cfc87ca459eTimo Sirainen Allows one to specify signal name or number, sent by lxc-stop to
70058d29cf8c77501741ddbc39178cfc87ca459eTimo Sirainen reboot the container. This option allows signal to be specified in
40440c0fee87be994ba7eb60fc3512a9355708aaTimo Sirainen kill(1) fashion, e.g. SIGTERM, SIGRTMIN+14, SIGRTMAX-10 or plain number.
979d89c147520f2934c14c31aeb9310fd2d62a46Timo Sirainen The default signal is SIGINT.
237a6211c7fc4d6dbb58dd0467da6dba1b8f21f6Timo Sirainen lxc-stop がコンテナをリブートするために送るシグナル名か番号を指定できます。
979d89c147520f2934c14c31aeb9310fd2d62a46Timo Sirainen このオプションではシグナルとして kill(1) で使う形式を指定することができます。
979d89c147520f2934c14c31aeb9310fd2d62a46Timo Sirainen 例えば SIGKILL, SIGRTMIN+14, SIGRTMAX-10 のような形式、もしくは数字を指定します。デフォルトのシグナルは SIGINT です。
979d89c147520f2934c14c31aeb9310fd2d62a46Timo Sirainen <variablelist>
979d89c147520f2934c14c31aeb9310fd2d62a46Timo Sirainen <varlistentry>
70058d29cf8c77501741ddbc39178cfc87ca459eTimo Sirainen specify the signal used to reboot the container
979d89c147520f2934c14c31aeb9310fd2d62a46Timo Sirainen コンテナをリブートするために使うシグナルを指定します。
979d89c147520f2934c14c31aeb9310fd2d62a46Timo Sirainen </varlistentry>
979d89c147520f2934c14c31aeb9310fd2d62a46Timo Sirainen </variablelist>
70058d29cf8c77501741ddbc39178cfc87ca459eTimo Sirainen Allows one to specify signal name or number, sent by lxc-stop to forcibly
70058d29cf8c77501741ddbc39178cfc87ca459eTimo Sirainen shutdown the container. This option allows signal to be specified in
70058d29cf8c77501741ddbc39178cfc87ca459eTimo Sirainen kill(1) fashion, e.g. SIGKILL, SIGRTMIN+14, SIGRTMAX-10 or plain number.
70058d29cf8c77501741ddbc39178cfc87ca459eTimo Sirainen The default signal is SIGKILL.
979d89c147520f2934c14c31aeb9310fd2d62a46Timo Sirainen lxc-stop がコンテナを強制的にシャットダウンするために送るシグナル名か番号を指定することができます。
40440c0fee87be994ba7eb60fc3512a9355708aaTimo Sirainen このオプションではシグナルとして kill(1) で使う形式を指定することができます。
40440c0fee87be994ba7eb60fc3512a9355708aaTimo Sirainen 例えば SIGKILL, SIGRTMIN+14, SIGRTMAX-10 のような形式、もしくは数字を指定します。デフォルトのシグナルは SIGKILL です。
40440c0fee87be994ba7eb60fc3512a9355708aaTimo Sirainen <variablelist>
70058d29cf8c77501741ddbc39178cfc87ca459eTimo Sirainen <varlistentry>
70058d29cf8c77501741ddbc39178cfc87ca459eTimo Sirainen specify the signal used to stop the container
70058d29cf8c77501741ddbc39178cfc87ca459eTimo Sirainen コンテナを停止するのに使用するシグナルを指定します。
70058d29cf8c77501741ddbc39178cfc87ca459eTimo Sirainen </varlistentry>
70058d29cf8c77501741ddbc39178cfc87ca459eTimo Sirainen </variablelist>
464e82904c6670bd6c96b8793ceb294d776d6f44Timo Sirainen Sets the command to use as the init system for the containers.
70058d29cf8c77501741ddbc39178cfc87ca459eTimo Sirainen This option is ignored when using lxc-execute.
464e82904c6670bd6c96b8793ceb294d776d6f44Timo Sirainen Defaults to: /sbin/init
464e82904c6670bd6c96b8793ceb294d776d6f44Timo Sirainen コンテナの init として使うコマンドを設定します。
40440c0fee87be994ba7eb60fc3512a9355708aaTimo Sirainen このオプションは lxc-execute では無視されます。
14f6fe5d6c4834f273ca573c23c0659a93123363Timo Sirainen <variablelist>
14f6fe5d6c4834f273ca573c23c0659a93123363Timo Sirainen <varlistentry>
3561c7bb472a78af74d755219cc0fc71c85ff5c2Timo Sirainen Absolute path from container rootfs to the binary to use as init.
ae949831f1f668b5501b4b125e7f7b1767fb109bTimo Sirainen init として使うバイナリの、コンテナの rootfs からの絶対パスを指定します。
03af8e5325a7b4fec36414ac35949457bc426c0bTimo Sirainen </varlistentry>
03af8e5325a7b4fec36414ac35949457bc426c0bTimo Sirainen </variablelist>
979d89c147520f2934c14c31aeb9310fd2d62a46Timo Sirainen Sets the UID/GID to use for the init system, and subsequent command, executed by lxc-execute.
979d89c147520f2934c14c31aeb9310fd2d62a46Timo Sirainen lxc-execute が実行するコンテナの init と、その後に起動するコマンドが使用する UID/GID を設定します。
979d89c147520f2934c14c31aeb9310fd2d62a46Timo Sirainen These options are only used when lxc-execute is started in a private user namespace.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen このオプションは lxc-execute がユーザ名前空間内で起動するときのみ使われます。
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen Defaults to: UID(0), GID(0)
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen デフォルト値は UID(0), GID(0) です。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <variablelist>
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen <varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen UID to use within a private user namesapce for init.
7d315281ae13a66e13da2b1ad006bdb883018278Timo Sirainen ユーザ名前空間内で init が使う UID です。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen </varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <varlistentry>
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen GID to use within a private user namesapce for init.
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen ユーザ名前空間内で init が使う GID です。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen </varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen </variablelist>
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen Allows one to specify whether a container will be destroyed on shutdown.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen シャットダウン後にコンテナを削除するかどうかを指定できます。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <variablelist>
6abf66a3731d52889517bd644595c540e3a9b3ecTimo Sirainen <varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen The only allowed values are 0 and 1. Set this to 1 to destroy a
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen container on shutdown.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 指定できる値は 0 または 1 のみです。この値を 1 に設定すると、シャットダウン後にコンテナを削除します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen </varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen </variablelist>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen The network section defines how the network is virtualized in
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen the container. The network virtualization acts at layer
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen two. In order to use the network virtualization, parameters
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen must be specified to define the network interfaces of the
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen container. Several virtual interfaces can be assigned and used
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen in a container even if the system has only one physical
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen network interface.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen ネットワークセクションは、コンテナ内でどのようにネットワークを仮想化するかを定義します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen ネットワークの仮想化はレイヤー 2 で作動します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen ネットワークの仮想化を使用するためには、コンテナのネットワークインターフェースを定義しなければなりません。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen いくつかの仮想インターフェースをアサインすることができます。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen そして、仮に物理ネットワークインターフェースが一つしかなくても、コンテナ内でいくつもの仮想インターフェースを使うことができます。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <variablelist>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <varlistentry>
cce2c665bb24537bb691f6cad6a36f8080e4a552Timo Sirainen specify what kind of network virtualization to be used
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen for the container. Each time
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen a <option>lxc.network.type</option> field is found a new
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen round of network configuration begins. In this way,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen several network virtualization types can be specified
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen for the same container, as well as assigning several
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen network interfaces for one container. The different
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen virtualization types can sbe:
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen コンテナがどの種類のネットワーク仮想化を使うかを指定します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 一つのネットワークの設定ごとに <option>lxc.network.type</option> フィールドを指定します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen このように、一つのコンテナに複数のネットワークインターフェースを割り当てることができるだけでなく、同じコンテナに対して複数のネットワーク仮想化の種類を指定することが出来ます。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 仮想化の種類は以下の値を取る事が出来ます:
6abf66a3731d52889517bd644595c540e3a9b3ecTimo Sirainen <option>none:</option> will cause the container to share
7d315281ae13a66e13da2b1ad006bdb883018278Timo Sirainen the host's network namespace. This means the host
7d315281ae13a66e13da2b1ad006bdb883018278Timo Sirainen network devices are usable in the container. It also
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen means that if both the container and host have upstart as
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen init, 'halt' in a container (for instance) will shut down the
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen これにより、ホストのネットワークデバイスをコンテナ内で使うことが可能になります。
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen もしコンテナもホストも init として upstart を使っている場合、(例えば) コンテナ内で 'halt' を実行すると、ホストがシャットダウンしてしまうことにもなります。
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen <option>empty:</option> will create only the loopback
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>empty:</option> ループバックインターフェースだけを作成します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>veth:</option> a virtual ethernet pair
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen device is created with one side assigned to the container
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen and the other side attached to a bridge specified by
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen the <option>lxc.network.link</option> option.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen If the bridge is not specified, then the veth pair device
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen will be created but not attached to any bridge.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen Otherwise, the bridge has to be created on the system
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen before starting the container.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <command>lxc</command> won't handle any
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen configuration outside of the container.
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen By default, <command>lxc</command> chooses a name for the
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen network device belonging to the outside of the
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen container, but if you wish to handle
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen this name yourselves, you can tell <command>lxc</command>
e83126866761632b437e532dfdc30be01d14039dTimo Sirainen to set a specific name with
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen the <option>lxc.network.veth.pair</option> option (except for
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen unprivileged containers where this option is ignored for security
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>veth:</option > 一方がコンテナに、もう一方が <option>lxc.network.link</option> オプションで指定されたブリッジに接続されるペアの仮想イーサネットデバイスを作成します。
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen もし、ブリッジが指定されていない場合、veth ペアデバイスは作成されますが、ブリッジには接続されません。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen ブリッジはコンテナが開始する前にシステムで事前に設定しておく必要があります。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen デフォルトでは、<command>lxc</command> がコンテナの外部に属するネットワークデバイスに対する名前を決定します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen しかし、もしこの名前を自分で指定したい場合、<option>lxc.network.veth.pair</option> オプションを使って名前を設定し、lxc に対して指定をすることができます (非特権コンテナの場合をのぞきます。セキュリティ上の理由からこのオプションは無視されます)。
e475db821baf0c4680dec4441d033697ecebfe06Timo Sirainen <option>vlan:</option> a vlan interface is linked with
7d315281ae13a66e13da2b1ad006bdb883018278Timo Sirainen the interface specified by
e475db821baf0c4680dec4441d033697ecebfe06Timo Sirainen the <option>lxc.network.link</option> and assigned to
e475db821baf0c4680dec4441d033697ecebfe06Timo Sirainen the container. The vlan identifier is specified with the
e475db821baf0c4680dec4441d033697ecebfe06Timo Sirainen option <option>lxc.network.vlan.id</option>.
e475db821baf0c4680dec4441d033697ecebfe06Timo Sirainen <option>vlan:</option> vlan インターフェースは <option>lxc.network.link</option> で指定されたインターフェースとリンクし、コンテナに割り当てられます。
7d315281ae13a66e13da2b1ad006bdb883018278Timo Sirainen vlan の指定は <option>lxc.network.vlan.id</option> オプションで指定します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>macvlan:</option> a macvlan interface is linked
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen with the interface specified by
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen the <option>lxc.network.link</option> and assigned to
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen the container.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>lxc.network.macvlan.mode</option> specifies the
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen mode the macvlan will use to communicate between
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen different macvlan on the same upper device. The accepted
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen modes are <option>private</option>, <option>vepa</option>,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>bridge</option> and <option>passthru</option>.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen In <option>private</option> mode, the device never
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen communicates with any other device on the same upper_dev (default).
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen In <option>vepa</option> mode, the new Virtual Ethernet Port
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen Aggregator (VEPA) mode, it assumes that the adjacent
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen bridge returns all frames where both source and
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen destination are local to the macvlan port, i.e. the
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen bridge is set up as a reflective relay. Broadcast
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen frames coming in from the upper_dev get flooded to all
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen macvlan interfaces in VEPA mode, local frames are not
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen delivered locally. In <option>bridge</option> mode, it
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen provides the behavior of a simple bridge between
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen different macvlan interfaces on the same port. Frames
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen from one interface to another one get delivered directly
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen and are not sent out externally. Broadcast frames get
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen flooded to all other bridge ports and to the external
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen interface, but when they come back from a reflective
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen relay, we don't deliver them again. Since we know all
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen the MAC addresses, the macvlan bridge mode does not
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen require learning or STP like the bridge module does. In
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>passthru</option> mode, all frames received by
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen the physical interface are forwarded to the macvlan
a0ebe2a2271759599686f3480aee6a6fe445d16eTimo Sirainen interface. Only one macvlan interface in <option>passthru</option>
a0ebe2a2271759599686f3480aee6a6fe445d16eTimo Sirainen mode is possible for one physical interface.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>macvlan:</option> macvlan インターフェースは <option>lxc.network.link</option> により指定されるインターフェースとリンクし、コンテナに割り当てられます。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>lxc.network.macvlan.mode</option> でモードを指定すると、その macvlan の指定を、同じ上位デバイスで異なる macvlan の間の通信をする時に使います。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 指定できるモードは <option>private</option>、<option>vepa</option>、<option>bridge</option>、<option>passthru</option> のいずれかです。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>private</option> モードの場合、デバイスは同じ上位デバイスの他のデバイスとの通信を行いません (デフォルト)。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 新しい仮想イーサネットポート集約モード (Virtual Ethernet Port Aggregator (VEPA)) である <option>vepa</option> モードの場合、隣接したポートが、ソースとデスティネーションの両方が macvlan ポートに対してローカルであるフレームを全て返すと仮定します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen すなわち、ブリッジが reflective relay として設定されているということです。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 上位デバイスから入ってくるブロードキャストフレームは、VEPA モードである全ての macvlan インターフェースに送りつけられます。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen ローカルのフレームはローカルには配送されません。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>bridge</option> モードの場合、同じポートの異なる macvlan インターフェースの間のシンプルなブリッジとして動作します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen あるインターフェースから他のインターフェースへのフレームは、直接配送され、外部には送出されません。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen ブロードキャストフレームは、全ての他のブリッジと外部のインターフェースに対して送られます。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen しかし、reflective relay からフレームが返ってきたときは、再度それを配送することはしません。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 全ての MAC アドレスを知っているので、ブリッジモジュールのように、macvlan ブリッジモードは学習や STP の必要はありません。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>passthru</option> モードの場合、物理インターフェースで受け取った全てのフレームは macvlan インターフェースに転送されます。<option>passthru</option> モードの場合、ひとつの macvlan インターフェースだけが、ひとつの物理インターフェースに対して設定できます。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>phys:</option> an already existing interface
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen specified by the <option>lxc.network.link</option> is
a85473f7c11c8734bdee9c2cbe4b767f144a18aaTimo Sirainen assigned to the container.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>phys:</option> <option>lxc.network.link</option> で指定された、すでに存在しているインターフェースがコンテナに割り当てられます。
f48fdb57185ca68e8c079e174f3e04da36646880Timo Sirainen </varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <varlistentry>
6abf66a3731d52889517bd644595c540e3a9b3ecTimo Sirainen specify an action to do for the
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen ネットワークに対して行うアクションを指定します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>up:</option> activates the interface.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen </varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen specify the interface to be used for real network
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 実際のネットワークトラフィックに使うインターフェースを指定します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen </varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen specify the maximum transfer unit for this interface.
31a574fda352ef4f71dbff9c30e15e4744e132c0Timo Sirainen インターフェースに対する MTU を指定します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen </varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen the interface name is dynamically allocated, but if
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen another name is needed because the configuration files
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen being used by the container use a generic name,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen eg. eth0, this option will rename the interface in the
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen インターフェース名は動的に割り当てられます。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen しかし、もしコンテナが使用する設定ファイルが一般的な名前を使用するために、他の特定の名前が必要であれば (例えば eth0 など)、コンテナ内のインターフェースは、このオプションで指定した名前にリネームされます。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen </varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen the interface mac address is dynamically allocated by
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen default to the virtual interface, but in some cases,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen this is needed to resolve a mac address conflict or to
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen always have the same link-local ipv6 address.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen Any "x" in address will be replaced by random value,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen this allows setting hwaddr templates.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 仮想インターフェースの MAC アドレスは、デフォルトでは動的に割り当てられます。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen しかし、MAC アドレスの衝突や、リンクローカルIPv6 アドレスを常に同じにした場合などは、このオプションが必要です。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen アドレス中の "x" という文字は、ランダムな値に置き換えられます。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen これによりテンプレートに hwaddr を設定することが可能になります。
31a574fda352ef4f71dbff9c30e15e4744e132c0Timo Sirainen </varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen specify the ipv4 address to assign to the virtualized
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen interface. Several lines specify several ipv4 addresses.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen The address is in format x.y.z.t/m,
40440c0fee87be994ba7eb60fc3512a9355708aaTimo Sirainen eg. 192.168.1.123/24.The broadcast address should be
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen specified on the same line, right after the ipv4
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 仮想インターフェースに割り当てる ipv4 アドレスを指定します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 複数行により複数の ipv4 アドレスを指定します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen このアドレスは x.y.z.t/m というフォーマットで指定します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 例えば、192.168.1.123/24。ブロードキャストアドレスも同じ行の ipv4 アドレスのすぐ後で指定しなくてはなりません。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen </varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen specify the ipv4 address to use as the gateway inside the
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen container. The address is in format x.y.z.t, eg.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 192.168.1.123.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen Can also have the special value <option>auto</option>,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen which means to take the primary address from the bridge
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen interface (as specified by the
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>lxc.network.link</option> option) and use that as
40440c0fee87be994ba7eb60fc3512a9355708aaTimo Sirainen the gateway. <option>auto</option> is only available when
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen using the <option>veth</option> and
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>macvlan</option> network types.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen コンテナでゲートウェイとして使う IPv4 アドレスを指定します。
63f01d5e4c9efe985fad63d5851dd1c5c153affaTimo Sirainen アドレスは x.y.z.t というフォーマットです。
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen 例えば、192.168.1.123。
40440c0fee87be994ba7eb60fc3512a9355708aaTimo Sirainen これは (<option>lxc.network.link</option> で指定した) ブリッジインターフェースの最初のアドレスを使用し、それをゲートウェイに使うという意味になります。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>auto</option> はネットワークタイプとして <option>veth</option> と <option>macvlan</option> を指定している時だけ有効となります。
e0c10ab25f82f3b5b099de5d84ece39efd18bc6aTimo Sirainen </varlistentry>
e0c10ab25f82f3b5b099de5d84ece39efd18bc6aTimo Sirainen <varlistentry>
e0c10ab25f82f3b5b099de5d84ece39efd18bc6aTimo Sirainen specify the ipv6 address to assign to the virtualized
e0c10ab25f82f3b5b099de5d84ece39efd18bc6aTimo Sirainen interface. Several lines specify several ipv6 addresses.
e0c10ab25f82f3b5b099de5d84ece39efd18bc6aTimo Sirainen The address is in format x::y/m,
e0c10ab25f82f3b5b099de5d84ece39efd18bc6aTimo Sirainen eg. 2003:db8:1:0:214:1234:fe0b:3596/64
e0c10ab25f82f3b5b099de5d84ece39efd18bc6aTimo Sirainen 仮想インターフェースに割り当てる ipv6 アドレスを指定します。
e0c10ab25f82f3b5b099de5d84ece39efd18bc6aTimo Sirainen 複数行により複数の ipv6 アドレスを指定します。
e0c10ab25f82f3b5b099de5d84ece39efd18bc6aTimo Sirainen このアドレスは x::y/m というフォーマットで指定します。
e0c10ab25f82f3b5b099de5d84ece39efd18bc6aTimo Sirainen </varlistentry>
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen <varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen specify the ipv6 address to use as the gateway inside the
a85473f7c11c8734bdee9c2cbe4b767f144a18aaTimo Sirainen container. The address is in format x::y,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen eg. 2003:db8:1:0::1
24bd831901b8fd59718e353b36eaef6a950f09a2Timo Sirainen Can also have the special value <option>auto</option>,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen which means to take the primary address from the bridge
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen interface (as specified by the
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>lxc.network.link</option> option) and use that as
ec047a9c54a02338e85fb1767120b0923f6d4148Timo Sirainen the gateway. <option>auto</option> is only available when
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen using the <option>veth</option> and
ec047a9c54a02338e85fb1767120b0923f6d4148Timo Sirainen <option>macvlan</option> network types.
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen コンテナでゲートウェイとして使う IPv6 アドレスを指定します。
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen アドレスは x::y というフォーマットです。例えば、2003:db8:1:0::1。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen これは (<option>lxc.network.link</option> で指定した) ブリッジインターフェースの最初のアドレスを使用し、それをゲートウェイに使うという意味になります。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen <option>auto</option> はネットワークタイプとして <option>veth</option> と <option>macvlan</option> を指定している時だけ有効となります。
16cd2c1b487b1fb63f3081761e0d1110d61137a9Timo Sirainen </varlistentry>
16cd2c1b487b1fb63f3081761e0d1110d61137a9Timo Sirainen <varlistentry>
ec047a9c54a02338e85fb1767120b0923f6d4148Timo Sirainen add a configuration option to specify a script to be
311cbd9b1c81df050f5019600a2a809bc620be00Timo Sirainen executed after creating and configuring the network used
311cbd9b1c81df050f5019600a2a809bc620be00Timo Sirainen from the host side. The following arguments are passed
ec047a9c54a02338e85fb1767120b0923f6d4148Timo Sirainen to the script: container name and config section name
ec047a9c54a02338e85fb1767120b0923f6d4148Timo Sirainen (net) Additional arguments depend on the config section
ec047a9c54a02338e85fb1767120b0923f6d4148Timo Sirainen employing a script hook; the following are used by the
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen network system: execution context (up), network type
e0c10ab25f82f3b5b099de5d84ece39efd18bc6aTimo Sirainen (empty/veth/macvlan/phys), Depending on the network
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen type, other arguments may be passed:
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen veth/macvlan/phys. And finally (host-sided) device name.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen ホスト側から使われる、ネットワークの作成と設定が済んだ後に実行するスクリプトを指定します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 以下の引数がスクリプトに渡されます: コンテナ名、設定セクション名(net)。
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen その後の引数はスクリプトのフックで使われる設定セクションに依存します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 以下がネットワークシステムによって使われます: 実行コンテキスト (up)、ネットワークのタイプ (empty/veth/macvlan/phys)
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen ネットワークのタイプによっては、更に別の引数が渡されるかもしれません: veth/macvlan/phys の場合 (ホスト側の) デバイス名
ce0e25f26d6e67480ee39b5ca0ad634fa60c4605Timo Sirainen Standard output from the script is logged at debug level.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen Standard error is not logged, but can be captured by the
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen hook redirecting its standard error to standard output.
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen スクリプトからの標準出力は debug レベルでロギングされます。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 標準エラー出力はロギングされません。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen しかし、フックの標準エラー出力を標準出力にリダイレクトすることにより保存することは可能です。
e475db821baf0c4680dec4441d033697ecebfe06Timo Sirainen </varlistentry>
e475db821baf0c4680dec4441d033697ecebfe06Timo Sirainen <varlistentry>
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen add a configuration option to specify a script to be
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen executed before destroying the network used from the
7d315281ae13a66e13da2b1ad006bdb883018278Timo Sirainen host side. The following arguments are passed to the
7d315281ae13a66e13da2b1ad006bdb883018278Timo Sirainen script: container name and config section name (net)
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen Additional arguments depend on the config section
f48fdb57185ca68e8c079e174f3e04da36646880Timo Sirainen employing a script hook; the following are used by the
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen network system: execution context (down), network type
e475db821baf0c4680dec4441d033697ecebfe06Timo Sirainen (empty/veth/macvlan/phys), Depending on the network
e475db821baf0c4680dec4441d033697ecebfe06Timo Sirainen type, other arguments may be passed:
e475db821baf0c4680dec4441d033697ecebfe06Timo Sirainen veth/macvlan/phys. And finally (host-sided) device name.
e475db821baf0c4680dec4441d033697ecebfe06Timo Sirainen ホスト側から使われる、ネットワークを破壊する前に実行するスクリプトを指定します。
464e82904c6670bd6c96b8793ceb294d776d6f44Timo Sirainen 以下の引数がスクリプトに渡されます: コンテナ名、設定セクション名(net)。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen その後の引数はスクリプトのフックで使われる設定セクションに依存します。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen 以下がネットワークシステムによって使われます: 実行コンテキスト (up)、ネットワークのタイプ (empty/veth/macvlan/phys)。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen ネットワークのタイプによっては、更に別の引数が渡されるかもしれません: veth/macvlan/phys。そして最後に (ホスト側の) デバイス名が渡されます。
7d315281ae13a66e13da2b1ad006bdb883018278Timo Sirainen Standard output from the script is logged at debug level.
979d89c147520f2934c14c31aeb9310fd2d62a46Timo Sirainen Standard error is not logged, but can be captured by the
7d315281ae13a66e13da2b1ad006bdb883018278Timo Sirainen hook redirecting its standard error to standard output.
7d315281ae13a66e13da2b1ad006bdb883018278Timo Sirainen スクリプトからの標準出力は debug レベルでロギングされます。
464e82904c6670bd6c96b8793ceb294d776d6f44Timo Sirainen 標準エラー出力はロギングされません。
464e82904c6670bd6c96b8793ceb294d776d6f44Timo Sirainen しかし、フックの標準エラー出力を標準出力にリダイレクトすることにより保存することは可能です。
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen </varlistentry>
464e82904c6670bd6c96b8793ceb294d776d6f44Timo Sirainen </variablelist>
そして、これらの (作成された) ファイルは <filename>/dev/console</filename> と <filename>/dev/ttyN</filename> にシンボリックリンクされます。
rootfs. If lxc.autodev is set to 1, then after mounting the container's
use of the <option>lxc.hook.autodev</option> hook.
デフォルトでは、lxc はコンテナの <filename>/dev</filename> 以下に fd, stdin, stdout, stderr のシンボリックリンクを作成しますが、自動的にはデバイスノードのエントリは作成しません。
lxc.autodev が 1 に設定されている場合、コンテナの rootfs をマウントした後、LXC は新しい tmpfs を <filename>/dev</filename> 以下にマウントします (100k 制限の)。
しかし、もしコンテナの設定が最初に、/home/joe のようなコンテナユーザのコントロール配下にあるディレクトリを、コンテナ中のある <filename>path</filename> にマウントし、その後 <filename>path</filename> 以下でマウントが行われるような場合、コンテナユーザがタイミングを見計らって自身のホームディレクトリ以下でシンボリックリンクを操作するような TOCTTOU 攻撃が成立する可能性があります。
<filename>/proc/sysrq-trigger</filename> read-only
ただし、<filename>/proc/sys</filename> と <filename>/proc/sysrq-trigger</filename> は、セキュリティとコンテナの隔離の目的でリードオンリーで再マウントされます。
<filename>/sys/fs/cgroup</filename> を tmpfs でマウントし、そのコンテナの追加が行われた全ての階層構造に対するディレクトリを作製し、その cgroup の名前でその中にサブディレクトリを作製し、そのコンテナ自身の cgroup をそのディレクトリにバインドマウントします。
コンテナが CAP_SYS_ADMIN ケーパビリティを保持している場合、<option>cgroup:rw</option> となります。保持していない場合、<option>cgroup:mixed</option> となります。
<filename>/sys/fs/cgroup</filename> を tmpfs でマウントし、そのコンテナの追加が行われた全ての階層構造に対するディレクトリを作製し、ホストからコンテナまでの階層構造を全てバインドマウントし、コンテナ自身の cgroup を除いてリードオンリーにします。
<option>cgroup</option> と比べると、コンテナ自身の cgroup に至るまでの全てのパスが tmpfs の下層のシンプルなディレクトリとなり、コンテナ自身の cgroup の外ではリードオンリーになりますが、<filename>/sys/fs/cgroup/$hierarchy</filename> はホストの全ての cgroup 階層構造を含みます。
この場合、コンテナは自身の cgroup から脱出する可能性があることに注意してください (コンテナが CAP_SYS_ADMIN を持ち、自身で cgroup ファイルシステムをマウント可能なら、いずれにせよそのようにするかもしれないことにも注意してください)。
コンテナが CAP_SYS_ADMIN ケーパビリティを保持している場合、<option>cgroup-full:rw</option> となります。保持していない場合、<option>cgroup-full:mixed</option> となります。
cgroup ファイルシステムの自動マウントが有効の場合、<filename>/sys/fs/cgroup</filename> 以下の tmpfs は常に読み書き可能でマウントされることに注意が必要です (しかし <option>:mixed</option> と <option>:ro</option> の場合は、個々の階層の <filename>/sys/fs/cgroup/$hierarchy</filename> は読み込み専用となるでしょう)。これは Ubuntu の
コマンドの特異な動きに対処するためのものです。特異な動きとは、<filename>/sys/fs/cgroup</filename> が読み込み専用でマウントされた状態で、コンテナが CAP_SYS_ADMIN を持たない場合、/sys/fs/cgroup を読み書き可能で再マウントしようとしてできないため、コンテナのブート時にユーザからの入力を待ってしまうというものです。
lxc.mount.auto = proc sys cgroup
lxc.mount.auto = proc:rw sys:rw cgroup-full:rw
もし rootfs が nbd デバイスの場合、<filename>nbd:file:1</filename> という指定は <filename>file</filename> を nbd デバイスとして使用し、その 1 番目のパーティションが rootfs としてマウントされます。
<filename>overlayfs:/lower:/upper</filename> という指定は、rootfs は <filename>/lower</filename> という読み込み専用でマウントされるディレクトリの上に、<filename>/upper</filename> というディレクトリを読み書き可能で重ね合わせてマウントします。
where to recursively bind <option>lxc.rootfs</option>
eg. <option>lxc.cgroup.cpuset.cpus</option>
lxc が apparmor サポートでコンパイルされ、インストールされている場合で、ホストで apparmor が有効な場合、コンテナが従って動くべき apparmor プロファイルは、コンテナの設定で指定することが可能です。
このフラグが 0 の場合 (デフォルト)、カーネルが apparmor のマウント機能をサポートしていない場合にコンテナが起動しません。これはカーネルを更新した後に機能が退行したことが検出できるようにするためです。
lxc が SELinux サポートでコンパイルされ、インストールされている場合で、ホストで SELinux が有効な場合、コンテナが従って動くべき SELinux コンテキストは、コンテナの設定で指定することが可能です。
バージョン 2 では、ポリシーはブラックリストもしくはホワイトリストで表され、ルールごとのアクションと、ポリシーごとのデフォルトのアクションを設定できます。そして、アーキテクチャごとの設定と、テキストで書かれたシステムコール名での設定が可能です。
<listitem><para> The hook type (i.e. 'clone' or 'pre-mount'). </para></listitem>
<listitem><para> LXC_SRC_NAME: in the case of the clone hook, this is the original container's name. </para></listitem>
<listitem><para> LXC_ROOTFS_PATH: this is the lxc.rootfs entry for the container. Note this is likely not where the mounted rootfs is to be found, use LXC_ROOTFS_MOUNT for that. </para></listitem>
<listitem><para>追加の引数。clone フックの場合、lxc-clone に渡される追加の引数は、フックへの引数として追加されます。stop フックの場合は、コンテナの名前空間のそれぞれに対するファイルディスクリプタへのパスが、名前空間名とともに渡されます。</para></listitem>
<listitem><para> LXC_ROOTFS_PATH: コンテナの lxc.rootfs エントリ。これはマウントされた rootfs が存在する場所にはならないでしょう。それには LXC_ROOTFS_MOUNT を使用してください。</para></listitem>
of the rootfs, i.e. to mount an encrypted filesystem. Mounts
<option>lxc.autodev</option> == 1.
<option>lxc.autodev</option> == 1 が設定されている場合で、マウントが完了し、マウント時のフックも実行された後ですが、pivot_root の前にコンテナの名前空間で実行するフック。
このフックの目的は、systemd ベースのコンテナ向けの autodev オプションが設定されている時に、コンテナの /dev ディレクトリを設定するのを支援することです。コンテナの /dev ディレクトリは、このフックが実行される時有効な ${<option>LXC_ROOTFS_MOUNT</option>} 環境変数からの相対パスとなります。
それぞれの名前空間に対応する追加の引数がフックに渡されます。その引数にはコロンで区切られた名前空間のタイプ名とファイル名が含まれており、ファイル名は名前空間に対するファイルディスクリプタを取得するのに使えます。
and, as such, not valid during the <option>lxc.hook.start</option> hook.
[<option>-c</option>] [<option>lxc.console</option>]
[<option>lxc.rootfs.mount</option>]
mounted to the rootfs.mount location.
[<option>lxc.rootfs</option>]
rootfs.mount へマウントされるコンテナのルートへのホスト上のパスです。
デフォルトでは、lxc パッケージのコンパイル条件に依存し、コンテナのスタートアップは ERROR レベルでのみロギングされ、コンテナのパス以下か、@LOGPATH@ 以下のどちらかにコンテナ名 (の後に '.log' が付与される) をもとにした名前でロギングされます。
具体的には、0 = trace, 1 = debug, 2 = info, 3 = notice, 4 = warn, 5 = error, 6 = critical, 7 = alert, and 8 = fatal です。
Two groups are special. One is the NULL group, i.e. the container does
コンテナはいくつでもグループに属することができ、全く属さないことも可能です。特別なグループが 2 つ存在します。1 つは NULL グループです。これはどのグループにも属さないコンテナです。もう 1 つは "onboot" グループです。
attempt to boot any containers with lxc.start.auto == 1 that is a member
of the "onboot" group. The startup will be in order of lxc.start.order.
If an lxc.start.delay has been specified, that delay will be honored
will proceed to boot containers with lxc.start.auto == 1 which are not
LXC サービスが有効になった状態でシステムがブートすると、最初に "onboot" グループのメンバーである lxc.start.auto == 1 が設定されたコンテナを起動しようとします。起動は lxc.start.order の順に起動します。
lxc.start.delay が指定されている場合、現在対象となっているコンテナに初期化の時間を与え、ホストシステムの負荷を低減するために、次のコンテナを開始させるまでに遅延時間を与えます。
"onboot" グループのメンバーが開始した後、LXC システムは lxc.start.auto == 1 が設定された、どのグループのメンバーでもない (NULL グループの) コンテナのブートを onboot グループのコンテナと同様に開始します。
its descendents), you can use <command>lxc.environment</command>
コンテナに環境変数を渡したい場合 (環境変数はコンテナの init とその子孫全てで利用可能です)、<command>lxc.environment</command> パラメータがその用途に使えます。
機微 (センシティブ) な情報を渡さないように注意が必要です。そのような情報を持たないコンテナ内のプロセスでこれらの環境変数が利用可能になってしまいます。環境変数は常に <command>/proc/PID/environ</command> 経由で利用可能になります。
lxc.environment = APP_ENV=production
lxc.environment = SYSLOG_SERVER=192.0.2.42
lxc.utsname = myhostname
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.name = eth0
lxc.network.hwaddr = 4a:49:43:49:79:bf
lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
lxc.id_map = u 0 100000 10000
lxc.id_map = g 0 100000 10000
the application, cpuset.cpus restricts usage of the defined cpu,
cpus.share prioritize the control group, devices.allow makes
cpuset.cpus は定義された cpu のみ使用できるように制限します。
cpus.share は、control group の (cpu) 優先度を指定します。
devices.allow は、特定のデバイスを使用可能にします。
lxc.cgroup.cpuset.cpus = 0,1
lxc.cgroup.cpu.shares = 1234
lxc.cgroup.devices.allow = c 1:3 rw
lxc.cgroup.devices.allow = b 8:0 rw
lxc.utsname = complex
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.hwaddr = 4a:49:43:49:79:bf
lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3597
lxc.network.ipv6 = 2003:db8:1:0:214:5432:feab:3588
lxc.network.type = macvlan
lxc.network.flags = up
lxc.network.link = eth0
lxc.network.hwaddr = 4a:49:43:49:79:bd
lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3596
lxc.network.type = phys
lxc.network.flags = up
lxc.network.link = dummy0
lxc.network.hwaddr = 4a:49:43:49:79:ff
lxc.network.ipv6 = 2003:db8:1:0:214:1234:fe0b:3297
lxc.cgroup.cpuset.cpus = 0,1
lxc.cgroup.cpu.shares = 1234
lxc.cgroup.devices.allow = c 1:3 rw
lxc.cgroup.devices.allow = b 8:0 rw
lxc.cap.drop = sys_module mknod setuid net_raw
lxc.cap.drop = mac_override