]>
Commit | Line | Data |
---|---|---|
2b371b26 SY |
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 Korean | |
25 | by Sungbae Yoo <sungbae.yoo at samsung.com> | |
26 | ||
27 | --> | |
28 | ||
29 | <!DOCTYPE refentry PUBLIC @docdtd@ [ | |
30 | ||
31 | <!ENTITY commonoptions SYSTEM "@builddir@/common_options.sgml"> | |
32 | <!ENTITY seealso SYSTEM "@builddir@/see_also.sgml"> | |
33 | ]> | |
34 | ||
35 | <refentry> | |
36 | ||
37 | <docinfo><date>@LXC_GENERATE_DATE@</date></docinfo> | |
38 | ||
39 | <refmeta> | |
40 | <refentrytitle>lxc-attach</refentrytitle> | |
41 | <manvolnum>1</manvolnum> | |
42 | </refmeta> | |
43 | ||
44 | <refnamediv> | |
45 | <refname>lxc-attach</refname> | |
46 | ||
47 | <refpurpose> | |
48 | <!-- | |
49 | start a process inside a running container. | |
50 | --> | |
51 | 실행 중인 컨테이너 내에 프로세스를 실행 | |
52 | </refpurpose> | |
53 | </refnamediv> | |
54 | ||
55 | <refsynopsisdiv> | |
56 | <cmdsynopsis> | |
57 | <command>lxc-attach</command> | |
58 | <arg choice="req">-n <replaceable>name</replaceable></arg> | |
59 | <arg choice="opt">-a <replaceable>arch</replaceable></arg> | |
60 | <arg choice="opt">-e</arg> | |
61 | <arg choice="opt">-s <replaceable>namespaces</replaceable></arg> | |
62 | <arg choice="opt">-R</arg> | |
63 | <arg choice="opt">--keep-env</arg> | |
64 | <arg choice="opt">--clear-env</arg> | |
65 | <arg choice="opt">-- <replaceable>command</replaceable></arg> | |
66 | </cmdsynopsis> | |
67 | </refsynopsisdiv> | |
68 | ||
69 | <refsect1> | |
70 | <title><!-- Description -->설명</title> | |
71 | ||
72 | <para> | |
73 | <!-- | |
74 | <command>lxc-attach</command> runs the specified | |
75 | <replaceable>command</replaceable> inside the container | |
76 | specified by <replaceable>name</replaceable>. The container | |
77 | has to be running already. | |
78 | --> | |
79 | <command>lxc-attach</command>는 <replaceable>name</replaceable>으로 지정한 컨테이너 내에 <replaceable>command</replaceable>를 실행한다. | |
80 | 해당 컨테이너는 실행중이어야 한다. | |
81 | </para> | |
82 | <para> | |
83 | <!-- | |
84 | If no <replaceable>command</replaceable> is specified, the | |
85 | current default shell of the user running | |
86 | <command>lxc-attach</command> will be looked up inside the | |
87 | container and executed. This will fail if no such user exists | |
88 | inside the container or the container does not have a working | |
89 | nsswitch mechanism. | |
90 | --> | |
4ff8fb6c | 91 | 만약 <replaceable>command</replaceable>가 지정되지 않았다면, <command>lxc-attach</command>가 현재 실행 중인 쉘이 컨테이너 안에도 있는지 검사하고 이를 실행한다. |
2b371b26 SY |
92 | 만약 컨테이너 안에 사용자가 존재하지 않거나, nsswitch가 제대로 동작하지 않는 경우에는 이 명령이 실패하게 된다. |
93 | </para> | |
94 | ||
95 | </refsect1> | |
96 | ||
97 | <refsect1> | |
98 | ||
99 | <title><!-- Options -->옵션</title> | |
100 | ||
101 | <variablelist> | |
102 | ||
103 | <varlistentry> | |
104 | <term> | |
105 | <option>-a, --arch <replaceable>arch</replaceable></option> | |
106 | </term> | |
107 | <listitem> | |
108 | <para> | |
109 | <!-- | |
110 | Specify the architecture which the kernel should appear to be | |
111 | running as to the command executed. This option will accept the | |
112 | same settings as the <option>lxc.arch</option> option in | |
113 | container configuration files, see | |
114 | <citerefentry> | |
115 | <refentrytitle><filename>lxc.conf</filename></refentrytitle> | |
116 | <manvolnum>5</manvolnum> | |
117 | </citerefentry>. By default, the current archictecture of the | |
118 | running container will be used. | |
119 | --> | |
120 | 명령어를 실행하는 컨테이너의 아키텍처를 지정한다. | |
121 | 이 옵션은 컨테이너의 설정파일에서 지정한 <option>lxc.arch</option> 옵션과 같은 것만 사용할 수 있다. | |
122 | <citerefentry> | |
123 | <refentrytitle><filename>lxc.conf</filename></refentrytitle> | |
124 | <manvolnum>5</manvolnum> | |
125 | </citerefentry>를 참조 바란다. 기본값은 실행 중인 컨테이너의 아키텍처이다. | |
126 | </para> | |
127 | </listitem> | |
128 | </varlistentry> | |
129 | ||
130 | <varlistentry> | |
131 | <term> | |
132 | <option> | |
133 | -e, --elevated-privileges <replaceable>privileges</replaceable> | |
134 | </option> | |
135 | </term> | |
136 | <listitem> | |
137 | <para> | |
138 | <!-- | |
139 | Do not drop privileges when running | |
140 | <replaceable>command</replaceable> inside the container. If | |
141 | this option is specified, the new process will | |
142 | <emphasis>not</emphasis> be added to the container's cgroup(s) | |
143 | and it will not drop its capabilities before executing. | |
144 | --> | |
145 | 컨테이너 내부에서 <replaceable>command</replaceable>를 실행할 때 privilege를 제거하지 않는다. | |
146 | 만약 이 옵션이 지정되었다면, 새로운 프로세스는 컨테이너의 cgroup에 추가되지 <emphasis>않는다</emphasis>. 그리고 실행 전 capability도 제거하지 않는다. | |
147 | </para> | |
148 | <para> | |
149 | <!-- | |
150 | You may specify privileges, in case you do not want to elevate all of | |
151 | them, as a pipe-separated list, e.g. | |
152 | <replaceable>CGROUP|LSM</replaceable>. Allowed values are | |
153 | <replaceable>CGROUP</replaceable>, <replaceable>CAP</replaceable> and | |
154 | <replaceable>LSM</replaceable> representing cgroup, capabilities and | |
155 | restriction privileges respectively. | |
156 | --> | |
157 | 만약 모든 privilege를 얻고 싶지 않을 경우에는 <replaceable>CGROUP|LSM</replaceable>와 같이 파이프(|)로 구분된 리스트를 사용할 수 있다. 허용되는 값은 <replaceable>CGROUP</replaceable>、<replaceable>CAP</replaceable>、<replaceable>LSM</replaceable>이다. 각각 cgroup, capability, MAC label을 나타낸다. | |
158 | </para> | |
159 | <para> | |
160 | <!-- | |
161 | <emphasis>Warning:</emphasis> This may leak privileges into the | |
162 | container if the command starts subprocesses that remain active | |
163 | after the main process that was attached is terminated. The | |
164 | (re-)starting of daemons inside the container is problematic, | |
165 | especially if the daemon starts a lot of subprocesses such as | |
166 | <command>cron</command> or <command>sshd</command>. | |
167 | <emphasis>Use with great care.</emphasis> | |
168 | --> | |
169 | <emphasis>경고 :</emphasis> | |
170 | 만약 명령어가 attach된 메인프로세스가 종료된 후에, 실행 상태로 남아있는 서브프로세스를 시작하려고 한다면, 컨테이너 내부로 privilege 누수가 발생할 수 있다. | |
171 | 컨테이너 내에서 데몬을 시작(또는 재시작)하는 것은 문제가 될 수 있다. 특히 만약 데몬이 많은 서브프로세스 를 실행하는 경우라면, 예를 들어 <command>cron</command>와 <command>sshd</command>와 같은 경우는 문제가 될 수 있다. | |
172 | <emphasis>충분한 주의를 기울여서 사용하여야 한다.</emphasis> | |
173 | </para> | |
174 | </listitem> | |
175 | </varlistentry> | |
176 | ||
177 | <varlistentry> | |
178 | <term> | |
179 | <option>-s, --namespaces <replaceable>namespaces</replaceable></option> | |
180 | </term> | |
181 | <listitem> | |
182 | <para> | |
183 | <!-- | |
184 | Specify the namespaces to attach to, as a pipe-separated list, | |
185 | e.g. <replaceable>NETWORK|IPC</replaceable>. Allowed values are | |
186 | <replaceable>MOUNT</replaceable>, <replaceable>PID</replaceable>, | |
187 | <replaceable>UTSNAME</replaceable>, <replaceable>IPC</replaceable>, | |
188 | <replaceable>USER </replaceable> and | |
189 | <replaceable>NETWORK</replaceable>. This allows one to change | |
190 | the context of the process to e.g. the network namespace of the | |
191 | container while retaining the other namespaces as those of the | |
192 | host. | |
193 | --> | |
194 | 붙일 네임스페이스를 지정한다. <replaceable>NETWORK|IPC</replaceable>와 같이 파이프(|)로 구분된 리스트를 사용할 수 있다. 허용되는 값은 <replaceable>MOUNT</replaceable>, <replaceable>PID</replaceable>, <replaceable>UTSNAME</replaceable>, <replaceable>IPC</replaceable>, <replaceable>USER </replaceable>, <replaceable>NETWORK</replaceable>이다. 이를 사용하여, 컨테이너의 네트워크 네임스페이스를 사용하면서도 다른 네임스페이스는 호스트의 것을 그대로 사용하는 등의 조작이 가능하다. | |
195 | </para> | |
196 | <para> | |
197 | <!-- | |
198 | <emphasis>Important:</emphasis> This option implies | |
199 | <option>-e</option>. | |
200 | --> | |
201 | <emphasis>중요 :</emphasis> 이 옵션은 <option>-e</option> 옵션을 포함하고 있다. | |
202 | </para> | |
203 | </listitem> | |
204 | </varlistentry> | |
205 | ||
206 | <varlistentry> | |
207 | <term> | |
208 | <option>-R, --remount-sys-proc</option> | |
209 | </term> | |
210 | <listitem> | |
211 | <para> | |
212 | <!-- | |
213 | When using <option>-s</option> and the mount namespace is not | |
214 | included, this flag will cause <command>lxc-attach</command> | |
215 | to remount <replaceable>/proc</replaceable> and | |
216 | <replaceable>/sys</replaceable> to reflect the current other | |
217 | namespace contexts. | |
218 | --> | |
219 | <option>-s</option>를 사용하여 마운트 네임스페이스를 포함하지 않았을 때, 이 플래그는 <command>lxc-attach</command>가 <replaceable>/proc</replaceable>와 <replaceable>/sys</replaceable>를 remount 하게 만든다. | |
220 | 이는 현재와 다른 네임스페이스 컨텍스트를 반영시키기 위함이다. | |
221 | </para> | |
222 | <para> | |
223 | <!-- | |
224 | Please see the <emphasis>Notes</emphasis> section for more | |
225 | details. | |
226 | --> | |
227 | 좀더 자세한 설명은 <emphasis>주의</emphasis>섹션을 참고하면 된다. | |
228 | </para> | |
229 | <para> | |
230 | <!-- | |
231 | This option will be ignored if one tries to attach to the | |
232 | mount namespace anyway. | |
233 | --> | |
234 | 만약 마운트 네임스페이스에 attach하려고 한다면, 이 옵션은 무시된다. | |
235 | </para> | |
236 | </listitem> | |
237 | </varlistentry> | |
238 | ||
239 | <varlistentry> | |
240 | <term> | |
241 | <option>--keep-env</option> | |
242 | </term> | |
243 | <listitem> | |
244 | <para> | |
245 | <!-- | |
246 | Keep the current environment for attached programs. This is | |
247 | the current default behaviour (as of version 0.9), but is | |
248 | is likely to change in the future, since this may leak | |
249 | undesirable information into the container. If you rely on | |
250 | the environment being available for the attached program, | |
251 | please use this option to be future-proof. In addition to | |
252 | current environment variables, container=lxc will be set. | |
253 | --> | |
254 | 현재의 환경변수를 attach될 프로그램에도 그대로 적용한다. 이것은 현재 기본 동작이지만 (버전 0.9에서), 향후에 충분히 바뀔 수도 있다. 왜냐하면, 이것은 컨테이너에게 바람직하지 않은 정보를 넘겨줄 수 있는 위험성이 있기 때문이다. 따라서 이 기능에 의존하고 있다면, 향후에도 이를 보장할 수 있도록 이 옵션을 사용하는 것이 좋다. 또한 현재 환경 변수와 더불어, container=lxc도 설정된다. | |
255 | </para> | |
256 | </listitem> | |
257 | </varlistentry> | |
258 | ||
259 | <varlistentry> | |
260 | <term> | |
261 | <option>--clear-env</option> | |
262 | </term> | |
263 | <listitem> | |
264 | <para> | |
265 | <!-- | |
266 | Clear the environment before attaching, so no undesired | |
267 | environment variables leak into the container. The variable | |
268 | container=lxc will be the only environment with which the | |
269 | attached program starts. | |
270 | --> | |
271 | attach하기 전에 모든 환경변수를 지운다. | |
272 | 이를 통해 바람직하지 않은 환경변수 누출을 막을 수 있다. container=lxc 만이 attach된 프로그램이 실행되기 전에 설정되는 유일한 환경변수이다. | |
273 | </para> | |
274 | </listitem> | |
275 | </varlistentry> | |
276 | ||
277 | </variablelist> | |
278 | ||
279 | </refsect1> | |
280 | ||
281 | &commonoptions; | |
282 | ||
283 | <refsect1> | |
284 | <title><!-- Examples -->예제</title> | |
285 | <para> | |
286 | <!-- | |
287 | To spawn a new shell running inside an existing container, use | |
288 | <programlisting> | |
289 | lxc-attach -n container | |
290 | </programlisting> | |
291 | --> | |
292 | 존재하는 컨테이너의 내부에 새로운 쉘을 실행한다. | |
293 | <programlisting> | |
294 | lxc-attach -n container | |
295 | </programlisting> | |
296 | </para> | |
297 | <para> | |
298 | <!-- | |
299 | To restart the cron service of a running Debian container, use | |
300 | <programlisting> | |
301 | lxc-attach -n container -- /etc/init.d/cron restart | |
302 | </programlisting> | |
303 | --> | |
304 | 실행중인 Debian 컨테이너의 cron 서비스를 재시작한다. | |
305 | <programlisting> | |
306 | lxc-attach -n container -- /etc/init.d/cron restart | |
307 | </programlisting> | |
308 | </para> | |
309 | <para> | |
310 | <!-- | |
311 | To deactivate the network link eth1 of a running container that | |
312 | does not have the NET_ADMIN capability, use either the | |
313 | <option>-e</option> option to use increased capabilities, | |
314 | assuming the <command>ip</command> tool is installed: | |
315 | <programlisting> | |
316 | lxc-attach -n container -e -- /sbin/ip link delete eth1 | |
317 | </programlisting> | |
318 | --> | |
319 | NET_ADMIN capability없이 실행중인 컨테이너의 네트워크 링크 eth1을 비활성화하였다. <option>-e</option> 옵션을 사용하여 capability를 높였고, <command>ip</command> 툴이 설치되어있다고 가정하였다. | |
320 | <programlisting> | |
321 | lxc-attach -n container -e -- /sbin/ip link delete eth1 | |
322 | </programlisting> | |
323 | </para> | |
324 | </refsect1> | |
325 | ||
326 | <refsect1> | |
327 | <title><!-- Compatibility -->호환성</title> | |
328 | <para> | |
329 | <!-- | |
330 | Attaching completely (including the pid and mount namespaces) to a | |
331 | container requires a kernel of version 3.8 or higher, or a | |
332 | patched kernel, please see the lxc website for | |
333 | details. <command>lxc-attach</command> will fail in that case if | |
334 | used with an unpatched kernel of version 3.7 and prior. | |
335 | --> | |
336 | (pid와 마운트 네임스페이스를 포함한) attach가 동작하기 위해서는 커널의 버전이 3.8 이상이거나 패치가 적용된 커널이어야 한다. 좀더 자세히 보려면 lxc 웹사이트를 참고하면 된다. <command>lxc-attach</command>는 패치되지 않은 커널 버전 3.7 이하면 실패된다. | |
337 | </para> | |
338 | <para> | |
339 | <!-- | |
340 | Nevertheless, it will succeed on an unpatched kernel of version 3.0 | |
341 | or higher if the <option>-s</option> option is used to restrict the | |
342 | namespaces that the process is to be attached to to one or more of | |
343 | <replaceable>NETWORK</replaceable>, <replaceable>IPC</replaceable> | |
344 | and <replaceable>UTSNAME</replaceable>. | |
345 | --> | |
346 | 그러나 <option>-s</option>를 사용하여 <replaceable>NETWORK</replaceable>, <replaceable>IPC</replaceable>, <replaceable>UTSNAME</replaceable> 네임스페이스 들만 지정한다면, 패치되지 않은 커널 3.0 이상에서도 성공적으로 동작한다. | |
347 | </para> | |
348 | <para> | |
349 | <!-- | |
350 | Attaching to user namespaces is supported by kernel 3.8 or higher | |
351 | with enabling user namespace. | |
352 | --> | |
353 | 사용자 네임스페이스에 attach하기 위해서는 커널 버전이 3.8 이상이어야 하고 사용자 네임스페이스가 활성화되어야 한다. | |
354 | </para> | |
355 | </refsect1> | |
356 | ||
357 | <refsect1> | |
358 | <title><!-- Notes -->주의</title> | |
359 | <para> | |
360 | <!-- | |
361 | The Linux <replaceable>/proc</replaceable> and | |
362 | <replaceable>/sys</replaceable> filesystems contain information | |
363 | about some quantities that are affected by namespaces, such as | |
364 | the directories named after process ids in | |
365 | <replaceable>/proc</replaceable> or the network interface information | |
366 | in <replaceable>/sys/class/net</replaceable>. The namespace of the | |
367 | process mounting the pseudo-filesystems determines what information | |
368 | is shown, <emphasis>not</emphasis> the namespace of the process | |
369 | accessing <replaceable>/proc</replaceable> or | |
370 | <replaceable>/sys</replaceable>. | |
371 | --> | |
372 | 리눅스의 <replaceable>/proc</replaceable>와 <replaceable>/sys</replaceable> 파일시스템은 네임스페이스의해 영향받는 몇가지 정보들을 포함하고 있다. 예를 들어 <replaceable>/proc</replaceable>의 프로세스 id로 된 폴더들이나 <replaceable>/sys/class/net</replaceable>의 네트워크 인터페이스 정보 등이다. | |
373 | 의사파일시스템을 마운트하는 프로세스의 네임스페이스가 여기에 어떤 정보를 표시할지 결정하는 것이지, <replaceable>/proc</replaceable> 또는 <replaceable>/sys</replaceable>에 접근하는 프로세스의 네임스페이스가 결정하는 것은 <emphasis>아니다.</emphasis> | |
374 | </para> | |
375 | <para> | |
376 | <!-- | |
377 | If one uses the <option>-s</option> option to only attach to | |
378 | the pid namespace of a container, but not its mount namespace | |
379 | (which will contain the <replaceable>/proc</replaceable> of the | |
380 | container and not the host), the contents of <option>/proc</option> | |
381 | will reflect that of the host and not the container. Analogously, | |
382 | the same issue occurs when reading the contents of | |
383 | <replaceable>/sys/class/net</replaceable> and attaching to just | |
384 | the network namespace. | |
385 | --> | |
4ff8fb6c SY |
386 | <option>-s</option> 를 사용하여 컨테이너의 pid 네임스페이스에만 attach 시키고 마운트 네임스페이스(컨테이너의 <replaceable>/proc</replaceable>는 포함하고, 호스트의 것은 포함하지 않는)는 attach 시키지 않는 경우, <option>/proc</option>의 내용은 컨테이너의 것이 아닌 호스트의 것이 된다. |
387 | 네트워크 네임스페이스만을 연결하고 <replaceable>/sys/class/net</replaceable>의 내용을 읽을 때도 같은 현상이 있다. | |
2b371b26 SY |
388 | </para> |
389 | <para> | |
390 | <!-- | |
391 | To work around this problem, the <option>-R</option> flag provides | |
392 | the option to remount <replaceable>/proc</replaceable> and | |
393 | <replaceable>/sys</replaceable> in order for them to reflect the | |
394 | network/pid namespace context of the attached process. In order | |
395 | not to interfere with the host's actual filesystem, the mount | |
396 | namespace will be unshared (like <command>lxc-unshare</command> | |
397 | does) before this is done, esentially giving the process a new | |
398 | mount namespace, which is identical to the hosts's mount namespace | |
399 | except for the <replaceable>/proc</replaceable> and | |
400 | <replaceable>/sys</replaceable> filesystems. | |
401 | --> | |
4ff8fb6c SY |
402 | 이러한 문제를 해결하기 위해, <option>-R</option> 옵션이 제공된다. 해당 옵션은 attach되는 프로세스의 네트워크/pid 네임스페이스를 반영하기 위해 <replaceable>/proc</replaceable>와 <replaceable>/sys</replaceable>를 다시 마운트한다. |
403 | 호스트의 실제 파일시스템에 방해가 되지 않기 위해 마운트 네임스페이스는 공유되지 않는다(<command>lxc-unshare</command>의 동작과 비슷). <replaceable>/proc</replaceable>와 <replaceable>/sys</replaceable> 파일시스템을 제외하고 호스트 마운트 네임스페이스와 동일한 새로운 마운트 네임스페이스가 주어지게 된다. | |
2b371b26 SY |
404 | </para> |
405 | </refsect1> | |
406 | ||
407 | <refsect1> | |
408 | <title><!-- Security -->보안</title> | |
409 | <para> | |
410 | <!-- | |
411 | The <option>-e</option> and <option>-s</option> options should | |
412 | be used with care, as it may break the isolation of the containers | |
413 | if used improperly. | |
414 | --> | |
4ff8fb6c | 415 | <option>-e</option>와 <option>-s</option> 옵션을 사용할때는 주의해야 한다. 잘못 사용하게 하면 컨테이너들 간의 고립(isolation)을 깨트릴 수 있다. |
2b371b26 SY |
416 | </para> |
417 | </refsect1> | |
418 | ||
419 | &seealso; | |
420 | ||
421 | <refsect1> | |
422 | <title><!-- Author -->저자</title> | |
423 | <para>Daniel Lezcano <email>daniel.lezcano@free.fr</email></para> | |
424 | </refsect1> | |
425 | ||
426 | </refentry> | |
427 | ||
428 | <!-- Keep this comment at the end of the file | |
429 | Local variables: | |
430 | mode: sgml | |
431 | sgml-omittag:t | |
432 | sgml-shorttag:t | |
433 | sgml-minimize-attributes:nil | |
434 | sgml-always-quote-attributes:t | |
435 | sgml-indent-step:2 | |
436 | sgml-indent-data:t | |
437 | sgml-parent-document:nil | |
438 | sgml-default-dtd-file:nil | |
439 | sgml-exposed-tags:nil | |
440 | sgml-local-catalogs:nil | |
441 | sgml-local-ecat-files:nil | |
442 | End: | |
443 | --> |