| 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-create</refentrytitle> |
| 15 |
<manvolnum>1</manvolnum> |
| 16 |
</refmeta> |
| 17 |
|
| 18 |
<refnamediv> |
| 19 |
<refname>lxc-create</refname> |
| 20 |
|
| 21 |
<refpurpose> |
| 22 |
creates a container |
| 23 |
</refpurpose> |
| 24 |
</refnamediv> |
| 25 |
|
| 26 |
<refsynopsisdiv> |
| 27 |
<cmdsynopsis> |
| 28 |
<command>lxc-create</command> |
| 29 |
<arg choice="req">-n <replaceable>name</replaceable></arg> |
| 30 |
<arg choice="opt">-f <replaceable>config_file</replaceable></arg> |
| 31 |
<arg choice="req">-t <replaceable>template</replaceable></arg> |
| 32 |
<arg choice="opt">-B <replaceable>backingstore</replaceable></arg> |
| 33 |
<arg choice="opt">-- <replaceable>template-options</replaceable></arg> |
| 34 |
</cmdsynopsis> |
| 35 |
</refsynopsisdiv> |
| 36 |
|
| 37 |
<refsect1> |
| 38 |
<title>Description</title> |
| 39 |
|
| 40 |
<para> |
| 41 |
<command>lxc-create</command> creates a system object where is |
| 42 |
stored the configuration information and where can be stored |
| 43 |
user information. The identifier <replaceable>name</replaceable> |
| 44 |
is used to specify the container to be used with the different |
| 45 |
lxc commands. |
| 46 |
</para> |
| 47 |
<para> |
| 48 |
The object is a directory created in <filename>@LXCPATH@</filename> |
| 49 |
and identified by its name. |
| 50 |
</para> |
| 51 |
|
| 52 |
<para> |
| 53 |
The object is the definition of the different resources an |
| 54 |
application can use or can see. The more the configuration file |
| 55 |
contains information, the more the container is isolated and |
| 56 |
the more the application is jailed. |
| 57 |
</para> |
| 58 |
|
| 59 |
<para> |
| 60 |
If the configuration file <replaceable>config_file</replaceable> |
| 61 |
is not specified, the container will be created with the default |
| 62 |
isolation: processes, sysv ipc and mount points. |
| 63 |
</para> |
| 64 |
</refsect1> |
| 65 |
|
| 66 |
<refsect1> |
| 67 |
<title>Options</title> |
| 68 |
<variablelist> |
| 69 |
|
| 70 |
<varlistentry> |
| 71 |
<term> |
| 72 |
<option>-f, --config <replaceable>config_file</replaceable></option> |
| 73 |
</term> |
| 74 |
<listitem> |
| 75 |
<para> |
| 76 |
Specify the configuration file to configure the virtualization |
| 77 |
and isolation functionalities for the container. |
| 78 |
</para> |
| 79 |
</listitem> |
| 80 |
</varlistentry> |
| 81 |
|
| 82 |
<varlistentry> |
| 83 |
<term> |
| 84 |
<option>-t, --template <replaceable>template</replaceable></option> |
| 85 |
</term> |
| 86 |
<listitem> |
| 87 |
<para> |
| 88 |
'template' is the short name of an existing 'lxc-template' |
| 89 |
script that is called by lxc-create, |
| 90 |
eg. busybox, debian, fedora, ubuntu or sshd. |
| 91 |
Refer to the examples in <filename>@LXCTEMPLATEDIR@</filename> |
| 92 |
for details of the expected script structure. |
| 93 |
Alternatively, the full path to an executable template script |
| 94 |
can also be passed as a parameter. |
| 95 |
"none" can be used to force lxc-create to skip rootfs creation. |
| 96 |
</para> |
| 97 |
</listitem> |
| 98 |
</varlistentry> |
| 99 |
|
| 100 |
<varlistentry> |
| 101 |
<term> |
| 102 |
<option>-B, --bdev <replaceable>backingstore</replaceable></option> |
| 103 |
</term> |
| 104 |
<listitem> |
| 105 |
<para> |
| 106 |
'backingstore' is one of 'dir', 'lvm', 'loop', 'btrfs', 'zfs', 'rbd', or 'best'. The |
| 107 |
default is 'dir', meaning that the container root filesystem |
| 108 |
will be a directory under <filename>@LXCPATH@/container/rootfs</filename>. |
| 109 |
This backing store type allows the optional |
| 110 |
<replaceable>--dir ROOTFS</replaceable> to be specified, meaning |
| 111 |
that the container rootfs should be placed under the specified path, |
| 112 |
rather than the default. (The 'none' backingstore type is an alias for |
| 113 |
'dir'.) If 'btrfs' is specified, then the |
| 114 |
target filesystem must be btrfs, and the container rootfs will be |
| 115 |
created as a new subvolume. This allows snapshotted clones to be |
| 116 |
created, but also causes rsync --one-filesystem to treat it as a |
| 117 |
separate filesystem. |
| 118 |
If backingstore is 'lvm', then an lvm block device will be |
| 119 |
used and the following further options are available: |
| 120 |
<replaceable>--lvname lvname1</replaceable> will create an LV |
| 121 |
named <filename>lvname1</filename> rather than the default, which |
| 122 |
is the container name. <replaceable>--vgname vgname1</replaceable> |
| 123 |
will create the LV in volume group <filename>vgname1</filename> |
| 124 |
rather than the default, <filename>lxc</filename>. |
| 125 |
<replaceable>--thinpool thinpool1</replaceable> will create the |
| 126 |
LV as a thin-provisioned volume in the pool named |
| 127 |
<filename>thinpool1</filename> rather than the |
| 128 |
default, <filename>lxc</filename>. |
| 129 |
<replaceable>--fstype FSTYPE</replaceable> will create an FSTYPE |
| 130 |
filesystem on the LV, rather than the default, which is ext4. |
| 131 |
<replaceable>--fssize SIZE</replaceable> will create a LV (and |
| 132 |
filesystem) of size SIZE rather than the default, which is 1G. |
| 133 |
</para> |
| 134 |
<para> |
| 135 |
If backingstore is 'loop', you can use <replaceable>--fstype FSTYPE</replaceable> and <replaceable>--fssize SIZE</replaceable> as 'lvm'. The default values for these options are the same as 'lvm'. |
| 136 |
</para> |
| 137 |
<para> |
| 138 |
If backingstore is 'rbd', then you will need to have a valid configuration in <filename>ceph.conf</filename> and a <filename>ceph.client.admin.keyring</filename> defined. |
| 139 |
You can specify the following options : |
| 140 |
<replaceable>--rbdname RBDNAME</replaceable> will create a blockdevice named RBDNAME rather than the default, which is the container name. |
| 141 |
<replaceable>--rbdpool POOL</replaceable> will create the blockdevice in the pool named POOL, rather than the default, which is 'lxc'. |
| 142 |
<replaceable>--rbduser RBDUSER</replaceable> will specify the ceph user RBDUSER creating the blockdevice, rather than the default, which is 'admin'. |
| 143 |
</para> |
| 144 |
<para> |
| 145 |
If backingstore is 'best', then lxc will try, in order, btrfs, |
| 146 |
zfs, lvm, and finally a directory backing store. |
| 147 |
</para> |
| 148 |
</listitem> |
| 149 |
</varlistentry> |
| 150 |
|
| 151 |
<varlistentry> |
| 152 |
<term> |
| 153 |
<option>-- <replaceable>template-options</replaceable></option> |
| 154 |
</term> |
| 155 |
<listitem> |
| 156 |
<para> |
| 157 |
This will pass <replaceable>template-options</replaceable> to the |
| 158 |
template as arguments. To see the list of options supported by |
| 159 |
the template, you can run |
| 160 |
<command>lxc-create -t TEMPLATE -h</command>. |
| 161 |
</para> |
| 162 |
</listitem> |
| 163 |
</varlistentry> |
| 164 |
|
| 165 |
</variablelist> |
| 166 |
|
| 167 |
</refsect1> |
| 168 |
|
| 169 |
&commonoptions; |
| 170 |
|
| 171 |
<refsect1> |
| 172 |
<title>Diagnostic</title> |
| 173 |
|
| 174 |
<variablelist> |
| 175 |
|
| 176 |
<varlistentry> |
| 177 |
<term>The container already exists</term> |
| 178 |
<listitem> |
| 179 |
<para> |
| 180 |
As the message mention it, you try to create a container |
| 181 |
but there is a container with the same name. You can use |
| 182 |
the <command>lxc-ls</command> command to list the |
| 183 |
available containers on the system. |
| 184 |
</para> |
| 185 |
</listitem> |
| 186 |
</varlistentry> |
| 187 |
|
| 188 |
</variablelist> |
| 189 |
|
| 190 |
</refsect1> |
| 191 |
|
| 192 |
&seealso; |
| 193 |
|
| 194 |
</refentry> |
| 195 |
|
| 196 |
<!-- Keep this comment at the end of the file |
| 197 |
Local variables: |
| 198 |
mode: sgml |
| 199 |
sgml-omittag:t |
| 200 |
sgml-shorttag:t |
| 201 |
sgml-minimize-attributes:nil |
| 202 |
sgml-always-quote-attributes:t |
| 203 |
sgml-indent-step:2 |
| 204 |
sgml-indent-data:t |
| 205 |
sgml-parent-document:nil |
| 206 |
sgml-default-dtd-file:nil |
| 207 |
sgml-exposed-tags:nil |
| 208 |
sgml-local-catalogs:nil |
| 209 |
sgml-local-ecat-files:nil |
| 210 |
End: |
| 211 |
--> |