| 1 |
<!-- SPDX-License-Identifier: LGPL-2.1+ --> |
| 2 |
|
| 3 |
<!DOCTYPE refentry PUBLIC @docdtd@ [ |
| 4 |
|
| 5 |
<!ENTITY commonoptions SYSTEM "@builddir@/common_options.sgml"> |
| 6 |
<!ENTITY seealso SYSTEM "@builddir@/see_also.sgml"> |
| 7 |
]> |
| 8 |
|
| 9 |
<refentry> |
| 10 |
|
| 11 |
<docinfo><date>@LXC_GENERATE_DATE@</date></docinfo> |
| 12 |
|
| 13 |
<refmeta> |
| 14 |
<refentrytitle>lxc-execute</refentrytitle> |
| 15 |
<manvolnum>1</manvolnum> |
| 16 |
</refmeta> |
| 17 |
|
| 18 |
<refnamediv> |
| 19 |
<refname>lxc-execute</refname> |
| 20 |
|
| 21 |
<refpurpose> |
| 22 |
run an application inside a container. |
| 23 |
</refpurpose> |
| 24 |
</refnamediv> |
| 25 |
|
| 26 |
<refsynopsisdiv> |
| 27 |
<cmdsynopsis> |
| 28 |
<command>lxc-execute</command> |
| 29 |
<arg choice="req">-n <replaceable>name</replaceable></arg> |
| 30 |
<arg choice="opt">-d</arg> |
| 31 |
<arg choice="opt">-f <replaceable>config_file</replaceable></arg> |
| 32 |
<arg choice="opt">-s KEY=VAL</arg> |
| 33 |
<arg choice="opt">-u, --uid <replaceable>uid</replaceable></arg> |
| 34 |
<arg choice="opt">-g, --gid <replaceable>gid</replaceable></arg> |
| 35 |
<arg choice="opt">-- <replaceable>command</replaceable></arg> |
| 36 |
</cmdsynopsis> |
| 37 |
</refsynopsisdiv> |
| 38 |
|
| 39 |
<refsect1> |
| 40 |
<title>Description</title> |
| 41 |
|
| 42 |
<para> |
| 43 |
<command>lxc-execute</command> runs the specified |
| 44 |
<replaceable>command</replaceable> inside the container |
| 45 |
specified by <replaceable>name</replaceable>. |
| 46 |
</para> |
| 47 |
<para> |
| 48 |
It will setup the container |
| 49 |
according to the configuration previously defined with the |
| 50 |
lxc-create command or with the configuration file parameter. |
| 51 |
If no configuration is |
| 52 |
defined, the default isolation is used. |
| 53 |
</para> |
| 54 |
<para> |
| 55 |
This command is mainly used when you want to quickly launch an |
| 56 |
application in an isolated environment. |
| 57 |
</para> |
| 58 |
<para> |
| 59 |
<command>lxc-execute</command> command will run the |
| 60 |
specified command into the container via an intermediate |
| 61 |
process, <command>lxc-init</command>. |
| 62 |
This lxc-init after launching the specified command, |
| 63 |
will wait for its end and all other reparented processes. |
| 64 |
(to support daemons in the container). |
| 65 |
In other words, in the |
| 66 |
container, <command>lxc-init</command> has the pid 1 and the |
| 67 |
first process of the application has the pid 2. |
| 68 |
</para> |
| 69 |
<para> |
| 70 |
The above <command>lxc-init</command> is designed to forward received |
| 71 |
signals to the started command. |
| 72 |
</para> |
| 73 |
</refsect1> |
| 74 |
|
| 75 |
<refsect1> |
| 76 |
<title>Options</title> |
| 77 |
<variablelist> |
| 78 |
|
| 79 |
<varlistentry> |
| 80 |
<term> |
| 81 |
<option>-f, --rcfile <replaceable>config_file</replaceable></option> |
| 82 |
</term> |
| 83 |
<listitem> |
| 84 |
<para> |
| 85 |
Specify the configuration file to configure the virtualization |
| 86 |
and isolation functionalities for the container. |
| 87 |
</para> |
| 88 |
<para> |
| 89 |
This configuration file if present will be used even if there is |
| 90 |
already a configuration file present in the previously created |
| 91 |
container (via lxc-create). |
| 92 |
</para> |
| 93 |
</listitem> |
| 94 |
</varlistentry> |
| 95 |
<varlistentry> |
| 96 |
<term> |
| 97 |
<option>-s, --define <replaceable>KEY=VAL</replaceable></option> |
| 98 |
</term> |
| 99 |
<listitem> |
| 100 |
<para> |
| 101 |
Assign value <replaceable>VAL</replaceable> to configuration |
| 102 |
variable <replaceable>KEY</replaceable>. This overrides any |
| 103 |
assignment done in <replaceable>config_file</replaceable>. |
| 104 |
</para> |
| 105 |
</listitem> |
| 106 |
</varlistentry> |
| 107 |
|
| 108 |
<varlistentry> |
| 109 |
<term> |
| 110 |
<option>-d, --daemon</option> |
| 111 |
</term> |
| 112 |
<listitem> |
| 113 |
<para> |
| 114 |
Run the container as a daemon. As the container has no |
| 115 |
more tty, if an error occurs nothing will be displayed, |
| 116 |
the log file can be used to check the error. |
| 117 |
</para> |
| 118 |
</listitem> |
| 119 |
</varlistentry> |
| 120 |
|
| 121 |
<varlistentry> |
| 122 |
<term> |
| 123 |
<option>-u, --uid <replaceable>uid</replaceable></option> |
| 124 |
</term> |
| 125 |
<listitem> |
| 126 |
<para> |
| 127 |
Executes the <replaceable>command</replaceable> with user ID (use numerical value) |
| 128 |
<replaceable>uid</replaceable> inside the container. |
| 129 |
</para> |
| 130 |
</listitem> |
| 131 |
</varlistentry> |
| 132 |
|
| 133 |
<varlistentry> |
| 134 |
<term> |
| 135 |
<option>--g, --gid <replaceable>gid</replaceable></option> |
| 136 |
</term> |
| 137 |
<listitem> |
| 138 |
<para> |
| 139 |
Executes the <replaceable>command</replaceable> with group ID (use numerical value) |
| 140 |
<replaceable>gid</replaceable> inside the container. |
| 141 |
</para> |
| 142 |
</listitem> |
| 143 |
</varlistentry> |
| 144 |
|
| 145 |
<varlistentry> |
| 146 |
<term><option>--</option></term> |
| 147 |
<listitem> |
| 148 |
<para> |
| 149 |
Signal the end of options and disables further option |
| 150 |
processing. Any arguments after the -- are treated as |
| 151 |
arguments to <replaceable>command</replaceable>. |
| 152 |
</para> |
| 153 |
<para> |
| 154 |
This option is useful when you want specify options |
| 155 |
to <replaceable>command</replaceable> and don't want |
| 156 |
<command>lxc-execute</command> to interpret them. |
| 157 |
</para> |
| 158 |
</listitem> |
| 159 |
</varlistentry> |
| 160 |
|
| 161 |
</variablelist> |
| 162 |
|
| 163 |
</refsect1> |
| 164 |
|
| 165 |
&commonoptions; |
| 166 |
|
| 167 |
<refsect1> |
| 168 |
<title>Diagnostic</title> |
| 169 |
|
| 170 |
<variablelist> |
| 171 |
|
| 172 |
<varlistentry> |
| 173 |
<term>The container is busy</term> |
| 174 |
<listitem> |
| 175 |
<para> |
| 176 |
The specified container is already running an |
| 177 |
application. You should stop it before reuse this |
| 178 |
container or create a new one. |
| 179 |
</para> |
| 180 |
</listitem> |
| 181 |
</varlistentry> |
| 182 |
|
| 183 |
</variablelist> |
| 184 |
|
| 185 |
</refsect1> |
| 186 |
|
| 187 |
&seealso; |
| 188 |
|
| 189 |
</refentry> |
| 190 |
|
| 191 |
<!-- Keep this comment at the end of the file |
| 192 |
Local variables: |
| 193 |
mode: sgml |
| 194 |
sgml-omittag:t |
| 195 |
sgml-shorttag:t |
| 196 |
sgml-minimize-attributes:nil |
| 197 |
sgml-always-quote-attributes:t |
| 198 |
sgml-indent-step:2 |
| 199 |
sgml-indent-data:t |
| 200 |
sgml-parent-document:nil |
| 201 |
sgml-default-dtd-file:nil |
| 202 |
sgml-exposed-tags:nil |
| 203 |
sgml-local-catalogs:nil |
| 204 |
sgml-local-ecat-files:nil |
| 205 |
End: |
| 206 |
--> |