]> git.proxmox.com Git - pve-docs.git/blame - pct.adoc
pct.adoc: remove empty line after blockid
[pve-docs.git] / pct.adoc
CommitLineData
80c0adcb 1[[chapter_pct]]
0c6b782f 2ifdef::manvolnum[]
b2f242ab 3pct(1)
7e2fdb3d 4======
38fd0958 5include::attributes.txt[]
5f09af76
DM
6:pve-toplevel:
7
0c6b782f
DM
8NAME
9----
10
11pct - Tool to manage Linux Containers (LXC) on Proxmox VE
12
13
49a5e11c 14SYNOPSIS
0c6b782f
DM
15--------
16
17include::pct.1-synopsis.adoc[]
18
19DESCRIPTION
20-----------
21endif::manvolnum[]
22
23ifndef::manvolnum[]
24Proxmox Container Toolkit
25=========================
38fd0958 26include::attributes.txt[]
194d2f29 27:pve-toplevel:
0c6b782f 28endif::manvolnum[]
5f09af76 29ifdef::wiki[]
cb84ed18 30:title: Linux Container
5f09af76 31endif::wiki[]
4a2ae9ed
DM
32
33Containers are a lightweight alternative to fully virtualized
34VMs. Instead of emulating a complete Operating System (OS), containers
35simply use the OS of the host they run on. This implies that all
36containers use the same kernel, and that they can access resources
37from the host directly.
38
39This is great because containers do not waste CPU power nor memory due
40to kernel emulation. Container run-time costs are close to zero and
41usually negligible. But there are also some drawbacks you need to
42consider:
43
44* You can only run Linux based OS inside containers, i.e. it is not
a8e99754 45 possible to run FreeBSD or MS Windows inside.
4a2ae9ed 46
a8e99754 47* For security reasons, access to host resources needs to be
4a2ae9ed 48 restricted. This is done with AppArmor, SecComp filters and other
a8e99754 49 kernel features. Be prepared that some syscalls are not allowed
4a2ae9ed
DM
50 inside containers.
51
52{pve} uses https://linuxcontainers.org/[LXC] as underlying container
53technology. We consider LXC as low-level library, which provides
a8e99754 54countless options. It would be too difficult to use those tools
4a2ae9ed
DM
55directly. Instead, we provide a small wrapper called `pct`, the
56"Proxmox Container Toolkit".
57
a8e99754 58The toolkit is tightly coupled with {pve}. That means that it is aware
4a2ae9ed
DM
59of the cluster setup, and it can use the same network and storage
60resources as fully virtualized VMs. You can even use the {pve}
61firewall, or manage containers using the HA framework.
62
63Our primary goal is to offer an environment as one would get from a
64VM, but without the additional overhead. We call this "System
65Containers".
66
99d2e25b 67NOTE: If you want to run micro-containers (with docker, rkt, ...), it
70a42028 68is best to run them inside a VM.
4a2ae9ed
DM
69
70
99f6ae1a
DM
71Technology Overview
72-------------------
73
74* LXC (https://linuxcontainers.org/)
75
76* Integrated into {pve} graphical user interface (GUI)
77
78* Easy to use command line tool `pct`
79
80* Access via {pve} REST API
81
82* lxcfs to provide containerized /proc file system
83
84* AppArmor/Seccomp to improve security
85
86* CRIU: for live migration (planned)
87
88* Use latest available kernels (4.4.X)
89
90* Image based deployment (templates)
91
92* Use {pve} storage library
93
94* Container setup from host (network, DNS, storage, ...)
95
96
4a2ae9ed
DM
97Security Considerations
98-----------------------
99
100Containers use the same kernel as the host, so there is a big attack
101surface for malicious users. You should consider this fact if you
102provide containers to totally untrusted people. In general, fully
a8e99754 103virtualized VMs provide better isolation.
4a2ae9ed
DM
104
105The good news is that LXC uses many kernel security features like
106AppArmor, CGroups and PID and user namespaces, which makes containers
107usage quite secure. We distinguish two types of containers:
108
5eba0743
FG
109
110Privileged Containers
4a2ae9ed
DM
111~~~~~~~~~~~~~~~~~~~~~
112
113Security is done by dropping capabilities, using mandatory access
114control (AppArmor), SecComp filters and namespaces. The LXC team
115considers this kind of container as unsafe, and they will not consider
116new container escape exploits to be security issues worthy of a CVE
117and quick fix. So you should use this kind of containers only inside a
118trusted environment, or when no untrusted task is running as root in
119the container.
120
5eba0743
FG
121
122Unprivileged Containers
4a2ae9ed
DM
123~~~~~~~~~~~~~~~~~~~~~~~
124
a8e99754 125This kind of containers use a new kernel feature called user
5eba0743 126namespaces. The root UID 0 inside the container is mapped to an
4a2ae9ed
DM
127unprivileged user outside the container. This means that most security
128issues (container escape, resource abuse, ...) in those containers
129will affect a random unprivileged user, and so would be a generic
a8e99754 130kernel security bug rather than an LXC issue. The LXC team thinks
4a2ae9ed
DM
131unprivileged containers are safe by design.
132
3bd9d0cf 133
53e3cd6f
DM
134Guest Operating System Configuration
135------------------------------------
136
137We normally try to detect the operating system type inside the
138container, and then modify some files inside the container to make
139them work as expected. Here is a short list of things we do at
140container startup:
141
142set /etc/hostname:: to set the container name
143
144modify /etc/hosts:: to allow lookup of the local hostname
145
146network setup:: pass the complete network setup to the container
147
148configure DNS:: pass information about DNS servers
149
150adapt the init system:: for example, fix the number of spawned getty processes
151
152set the root password:: when creating a new container
153
154rewrite ssh_host_keys:: so that each container has unique keys
155
156randomize crontab:: so that cron does not start at the same time on all containers
157
158Changes made by {PVE} are enclosed by comment markers:
159
160----
161# --- BEGIN PVE ---
162<data>
163# --- END PVE ---
164----
165
166Those markers will be inserted at a reasonable location in the
167file. If such a section already exists, it will be updated in place
168and will not be moved.
169
170Modification of a file can be prevented by adding a `.pve-ignore.`
171file for it. For instance, if the file `/etc/.pve-ignore.hosts`
172exists then the `/etc/hosts` file will not be touched. This can be a
173simple empty file creatd via:
174
175 # touch /etc/.pve-ignore.hosts
176
177Most modifications are OS dependent, so they differ between different
178distributions and versions. You can completely disable modifications
179by manually setting the `ostype` to `unmanaged`.
180
181OS type detection is done by testing for certain files inside the
182container:
183
184Ubuntu:: inspect /etc/lsb-release (`DISTRIB_ID=Ubuntu`)
185
186Debian:: test /etc/debian_version
187
188Fedora:: test /etc/fedora-release
189
190RedHat or CentOS:: test /etc/redhat-release
191
192ArchLinux:: test /etc/arch-release
193
194Alpine:: test /etc/alpine-release
195
196Gentoo:: test /etc/gentoo-release
197
198NOTE: Container start fails if the configured `ostype` differs from the auto
199detected type.
200
201
80c0adcb 202[[pct_container_images]]
d61bab51
DM
203Container Images
204----------------
205
8c1189b6
FG
206Container images, sometimes also referred to as ``templates'' or
207``appliances'', are `tar` archives which contain everything to run a
d61bab51 208container. You can think of it as a tidy container backup. Like most
8c1189b6 209modern container toolkits, `pct` uses those images when you create a
d61bab51
DM
210new container, for example:
211
212 pct create 999 local:vztmpl/debian-8.0-standard_8.0-1_amd64.tar.gz
213
26ca7ff5 214{pve} itself ships a set of basic templates for most common
8c1189b6 215operating systems, and you can download them using the `pveam` (short
d61bab51
DM
216for {pve} Appliance Manager) command line utility. You can also
217download https://www.turnkeylinux.org/[TurnKey Linux] containers using
218that tool (or the graphical user interface).
219
3a6fa247
DM
220Our image repositories contain a list of available images, and there
221is a cron job run each day to download that list. You can trigger that
222update manually with:
223
224 pveam update
225
226After that you can view the list of available images using:
227
228 pveam available
229
8c1189b6
FG
230You can restrict this large list by specifying the `section` you are
231interested in, for example basic `system` images:
3a6fa247
DM
232
233.List available system images
234----
235# pveam available --section system
236system archlinux-base_2015-24-29-1_x86_64.tar.gz
237system centos-7-default_20160205_amd64.tar.xz
238system debian-6.0-standard_6.0-7_amd64.tar.gz
239system debian-7.0-standard_7.0-3_amd64.tar.gz
240system debian-8.0-standard_8.0-1_amd64.tar.gz
241system ubuntu-12.04-standard_12.04-1_amd64.tar.gz
242system ubuntu-14.04-standard_14.04-1_amd64.tar.gz
243system ubuntu-15.04-standard_15.04-1_amd64.tar.gz
244system ubuntu-15.10-standard_15.10-1_amd64.tar.gz
245----
246
a8e99754 247Before you can use such a template, you need to download them into one
8c1189b6 248of your storages. You can simply use storage `local` for that
3a6fa247
DM
249purpose. For clustered installations, it is preferred to use a shared
250storage so that all nodes can access those images.
251
252 pveam download local debian-8.0-standard_8.0-1_amd64.tar.gz
253
24f73a63 254You are now ready to create containers using that image, and you can
8c1189b6 255list all downloaded images on storage `local` with:
24f73a63
DM
256
257----
258# pveam list local
259local:vztmpl/debian-8.0-standard_8.0-1_amd64.tar.gz 190.20MB
260----
261
a8e99754 262The above command shows you the full {pve} volume identifiers. They include
24f73a63 263the storage name, and most other {pve} commands can use them. For
5eba0743 264example you can delete that image later with:
24f73a63
DM
265
266 pveam remove local:vztmpl/debian-8.0-standard_8.0-1_amd64.tar.gz
3a6fa247 267
d61bab51 268
80c0adcb 269[[pct_container_storage]]
70a42028
DM
270Container Storage
271-----------------
272
273Traditional containers use a very simple storage model, only allowing
274a single mount point, the root file system. This was further
8c1189b6
FG
275restricted to specific file system types like `ext4` and `nfs`.
276Additional mounts are often done by user provided scripts. This turned
a8e99754 277out to be complex and error prone, so we try to avoid that now.
70a42028
DM
278
279Our new LXC based container model is more flexible regarding
280storage. First, you can have more than a single mount point. This
281allows you to choose a suitable storage for each application. For
282example, you can use a relatively slow (and thus cheap) storage for
283the container root file system. Then you can use a second mount point
284to mount a very fast, distributed storage for your database
4f785ca7
DM
285application. See section <<pct_mount_points,Mount Points>> for further
286details.
70a42028
DM
287
288The second big improvement is that you can use any storage type
289supported by the {pve} storage library. That means that you can store
8c1189b6
FG
290your containers on local `lvmthin` or `zfs`, shared `iSCSI` storage,
291or even on distributed storage systems like `ceph`. It also enables us
292to use advanced storage features like snapshots and clones. `vzdump`
a8e99754 293can also use the snapshot feature to provide consistent container
70a42028
DM
294backups.
295
296Last but not least, you can also mount local devices directly, or
297mount local directories using bind mounts. That way you can access
298local storage inside containers with zero overhead. Such bind mounts
a8e99754 299also provide an easy way to share data between different containers.
70a42028 300
eeecce95 301
4f785ca7
DM
302FUSE Mounts
303~~~~~~~~~~~
304
305WARNING: Because of existing issues in the Linux kernel's freezer
306subsystem the usage of FUSE mounts inside a container is strongly
307advised against, as containers need to be frozen for suspend or
308snapshot mode backups.
309
310If FUSE mounts cannot be replaced by other mounting mechanisms or storage
311technologies, it is possible to establish the FUSE mount on the Proxmox host
312and use a bind mount point to make it accessible inside the container.
313
314
315Using Quotas Inside Containers
316~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
317
318Quotas allow to set limits inside a container for the amount of disk
319space that each user can use. This only works on ext4 image based
320storage types and currently does not work with unprivileged
321containers.
322
323Activating the `quota` option causes the following mount options to be
324used for a mount point:
325`usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0`
326
327This allows quotas to be used like you would on any other system. You
328can initialize the `/aquota.user` and `/aquota.group` files by running
329
330----
331quotacheck -cmug /
332quotaon /
333----
334
335and edit the quotas via the `edquota` command. Refer to the documentation
336of the distribution running inside the container for details.
337
338NOTE: You need to run the above commands for every mount point by passing
339the mount point's path instead of just `/`.
340
341
342Using ACLs Inside Containers
343~~~~~~~~~~~~~~~~~~~~~~~~~~~~
344
345The standard Posix **A**ccess **C**ontrol **L**ists are also available inside containers.
346ACLs allow you to set more detailed file ownership than the traditional user/
347group/others model.
348
349
350[[pct_setting]]
351Container Settings
352------------------
353
9a5e9443 354[[pct_cpu]]
9a5e9443
DM
355CPU
356~~~
357
358You can restrict the number of visible CPUs inside the container using
359the `cores` option. This is implemented using the Linux 'cpuset'
360cgroup (**c**ontrol *group*). A special task inside `pvestatd` tries
361to distribute running containers among available CPUs. You can view
362the assigned CPUs using the following command:
363
364----
365# pct cpusets
366 ---------------------
367 102: 6 7
368 105: 2 3 4 5
369 108: 0 1
370 ---------------------
371----
372
373Containers use the host kernel directly, so all task inside a
374container are handled by the host CPU scheduler. {pve} uses the Linux
375'CFS' (**C**ompletely **F**air **S**cheduler) scheduler by default,
376which has additional bandwidth control options.
377
378[horizontal]
0725e3c6
DM
379
380`cpulimit`: :: You can use this option to further limit assigned CPU
9a5e9443
DM
381time. Please note that this is a floating point number, so it is
382perfectly valid to assign two cores to a container, but restrict
383overall CPU consumption to half a core.
384+
385----
386cores: 2
387cpulimit: 0.5
388----
389
0725e3c6 390`cpuunits`: :: This is a relative weight passed to the kernel
9a5e9443
DM
391scheduler. The larger the number is, the more CPU time this container
392gets. Number is relative to the weights of all the other running
393containers. The default is 1024. You can use this setting to
394prioritize some containers.
395
396
397[[pct_memory]]
398Memory
399~~~~~~
400
401Container memory is controlled using the cgroup memory controller.
402
403[horizontal]
404
0725e3c6 405`memory`: :: Limit overall memory usage. This corresponds
9a5e9443
DM
406to the `memory.limit_in_bytes` cgroup setting.
407
0725e3c6 408`swap`: :: Allows the container to use additional swap memory from the
9a5e9443
DM
409host swap space. This corresponds to the `memory.memsw.limit_in_bytes`
410cgroup setting, which is set to the sum of both value (`memory +
411swap`).
412
4f785ca7
DM
413
414[[pct_mount_points]]
9e44e493
DM
415Mount Points
416~~~~~~~~~~~~
eeecce95 417
01639994
FG
418The root mount point is configured with the `rootfs` property, and you can
419configure up to 10 additional mount points. The corresponding options
420are called `mp0` to `mp9`, and they can contain the following setting:
421
422include::pct-mountpoint-opts.adoc[]
423
9e44e493
DM
424Currently there are basically three types of mount points: storage backed
425mount points, bind mounts and device mounts.
426
5eba0743 427.Typical container `rootfs` configuration
4c3b5c77
DM
428----
429rootfs: thin1:base-100-disk-1,size=8G
430----
431
432
5eba0743 433Storage Backed Mount Points
4c3b5c77 434^^^^^^^^^^^^^^^^^^^^^^^^^^^
01639994 435
9e44e493 436Storage backed mount points are managed by the {pve} storage subsystem and come
eeecce95
WB
437in three different flavors:
438
5eba0743 439- Image based: these are raw images containing a single ext4 formatted file
eeecce95 440 system.
5eba0743 441- ZFS subvolumes: these are technically bind mounts, but with managed storage,
eeecce95
WB
442 and thus allow resizing and snapshotting.
443- Directories: passing `size=0` triggers a special case where instead of a raw
444 image a directory is created.
445
4c3b5c77 446
5eba0743 447Bind Mount Points
4c3b5c77 448^^^^^^^^^^^^^^^^^
01639994 449
9baca183
FG
450Bind mounts allow you to access arbitrary directories from your Proxmox VE host
451inside a container. Some potential use cases are:
452
453- Accessing your home directory in the guest
454- Accessing an USB device directory in the guest
acccc49b 455- Accessing an NFS mount from the host in the guest
9baca183 456
eeecce95 457Bind mounts are considered to not be managed by the storage subsystem, so you
9baca183 458cannot make snapshots or deal with quotas from inside the container. With
eeecce95 459unprivileged containers you might run into permission problems caused by the
9baca183
FG
460user mapping and cannot use ACLs.
461
8c1189b6 462NOTE: The contents of bind mount points are not backed up when using `vzdump`.
eeecce95 463
6b707f2c
FG
464WARNING: For security reasons, bind mounts should only be established
465using source directories especially reserved for this purpose, e.g., a
466directory hierarchy under `/mnt/bindmounts`. Never bind mount system
467directories like `/`, `/var` or `/etc` into a container - this poses a
9baca183
FG
468great security risk.
469
470NOTE: The bind mount source path must not contain any symlinks.
471
472For example, to make the directory `/mnt/bindmounts/shared` accessible in the
473container with ID `100` under the path `/shared`, use a configuration line like
8c1189b6
FG
474`mp0: /mnt/bindmounts/shared,mp=/shared` in `/etc/pve/lxc/100.conf`.
475Alternatively, use `pct set 100 -mp0 /mnt/bindmounts/shared,mp=/shared` to
9baca183 476achieve the same result.
6b707f2c 477
4c3b5c77 478
5eba0743 479Device Mount Points
4c3b5c77 480^^^^^^^^^^^^^^^^^^^
fe154a4f 481
7432d78e
FG
482Device mount points allow to mount block devices of the host directly into the
483container. Similar to bind mounts, device mounts are not managed by {PVE}'s
484storage subsystem, but the `quota` and `acl` options will be honored.
485
486NOTE: Device mount points should only be used under special circumstances. In
487most cases a storage backed mount point offers the same performance and a lot
488more features.
489
8c1189b6 490NOTE: The contents of device mount points are not backed up when using `vzdump`.
01639994 491
4c3b5c77 492
80c0adcb 493[[pct_container_network]]
f5c351f0
DM
494Network
495~~~~~~~
04c569f6 496
bac8c385 497You can configure up to 10 network interfaces for a single
8c1189b6 498container. The corresponding options are called `net0` to `net9`, and
bac8c385
DM
499they can contain the following setting:
500
501include::pct-network-opts.adoc[]
04c569f6
DM
502
503
51e33128
FG
504Backup and Restore
505------------------
506
5eba0743 507
2175e37b
FG
508Container Backup
509~~~~~~~~~~~~~~~~
510
8c1189b6
FG
511It is possible to use the `vzdump` tool for container backup. Please
512refer to the `vzdump` manual page for details.
513
51e33128 514
2175e37b
FG
515Restoring Container Backups
516~~~~~~~~~~~~~~~~~~~~~~~~~~~
517
8c1189b6
FG
518Restoring container backups made with `vzdump` is possible using the
519`pct restore` command. By default, `pct restore` will attempt to restore as much
2175e37b
FG
520of the backed up container configuration as possible. It is possible to override
521the backed up configuration by manually setting container options on the command
8c1189b6 522line (see the `pct` manual page for details).
2175e37b 523
8c1189b6 524NOTE: `pvesm extractconfig` can be used to view the backed up configuration
2175e37b
FG
525contained in a vzdump archive.
526
527There are two basic restore modes, only differing by their handling of mount
528points:
529
4c3b5c77 530
8c1189b6
FG
531``Simple'' Restore Mode
532^^^^^^^^^^^^^^^^^^^^^^^
2175e37b
FG
533
534If neither the `rootfs` parameter nor any of the optional `mpX` parameters
535are explicitly set, the mount point configuration from the backed up
536configuration file is restored using the following steps:
537
538. Extract mount points and their options from backup
539. Create volumes for storage backed mount points (on storage provided with the
540`storage` parameter, or default local storage if unset)
541. Extract files from backup archive
542. Add bind and device mount points to restored configuration (limited to root user)
543
544NOTE: Since bind and device mount points are never backed up, no files are
545restored in the last step, but only the configuration options. The assumption
546is that such mount points are either backed up with another mechanism (e.g.,
547NFS space that is bind mounted into many containers), or not intended to be
548backed up at all.
549
550This simple mode is also used by the container restore operations in the web
551interface.
552
4c3b5c77 553
8c1189b6
FG
554``Advanced'' Restore Mode
555^^^^^^^^^^^^^^^^^^^^^^^^^
2175e37b
FG
556
557By setting the `rootfs` parameter (and optionally, any combination of `mpX`
8c1189b6 558parameters), the `pct restore` command is automatically switched into an
2175e37b
FG
559advanced mode. This advanced mode completely ignores the `rootfs` and `mpX`
560configuration options contained in the backup archive, and instead only
561uses the options explicitly provided as parameters.
562
563This mode allows flexible configuration of mount point settings at restore time,
564for example:
565
566* Set target storages, volume sizes and other options for each mount point
567individually
568* Redistribute backed up files according to new mount point scheme
569* Restore to device and/or bind mount points (limited to root user)
570
51e33128 571
8c1189b6 572Managing Containers with `pct`
04c569f6
DM
573------------------------------
574
8c1189b6 575`pct` is the tool to manage Linux Containers on {pve}. You can create
04c569f6
DM
576and destroy containers, and control execution (start, stop, migrate,
577...). You can use pct to set parameters in the associated config file,
578like network configuration or memory limits.
579
5eba0743 580
04c569f6
DM
581CLI Usage Examples
582~~~~~~~~~~~~~~~~~~
583
584Create a container based on a Debian template (provided you have
5eba0743 585already downloaded the template via the web interface)
04c569f6
DM
586
587 pct create 100 /var/lib/vz/template/cache/debian-8.0-standard_8.0-1_amd64.tar.gz
588
589Start container 100
590
591 pct start 100
592
593Start a login session via getty
594
595 pct console 100
596
597Enter the LXC namespace and run a shell as root user
598
599 pct enter 100
600
601Display the configuration
602
603 pct config 100
604
8c1189b6 605Add a network interface called `eth0`, bridged to the host bridge `vmbr0`,
04c569f6
DM
606set the address and gateway, while it's running
607
608 pct set 100 -net0 name=eth0,bridge=vmbr0,ip=192.168.15.147/24,gw=192.168.15.1
609
610Reduce the memory of the container to 512MB
611
0585f29a
DM
612 pct set 100 -memory 512
613
04c569f6 614
fe57a420
FG
615Obtaining Debugging Logs
616~~~~~~~~~~~~~~~~~~~~~~~~
617
618In case `pct start` is unable to start a specific container, it might be
619helpful to collect debugging output by running `lxc-start` (replace `ID` with
620the container's ID):
621
622 lxc-start -n ID -F -l DEBUG -o /tmp/lxc-ID.log
623
624This command will attempt to start the container in foreground mode, to stop the container run `pct shutdown ID` or `pct stop ID` in a second terminal.
625
626The collected debug log is written to `/tmp/lxc-ID.log`.
627
628NOTE: If you have changed the container's configuration since the last start
629attempt with `pct start`, you need to run `pct start` at least once to also
630update the configuration used by `lxc-start`.
631
c7bc47af
DM
632
633[[pct_configuration]]
634Configuration
635-------------
636
637The `/etc/pve/lxc/<CTID>.conf` file stores container configuration,
638where `<CTID>` is the numeric ID of the given container. Like all
639other files stored inside `/etc/pve/`, they get automatically
640replicated to all other cluster nodes.
641
642NOTE: CTIDs < 100 are reserved for internal purposes, and CTIDs need to be
643unique cluster wide.
644
645.Example Container Configuration
646----
647ostype: debian
648arch: amd64
649hostname: www
650memory: 512
651swap: 512
652net0: bridge=vmbr0,hwaddr=66:64:66:64:64:36,ip=dhcp,name=eth0,type=veth
653rootfs: local:107/vm-107-disk-1.raw,size=7G
654----
655
656Those configuration files are simple text files, and you can edit them
657using a normal text editor (`vi`, `nano`, ...). This is sometimes
658useful to do small corrections, but keep in mind that you need to
659restart the container to apply such changes.
660
661For that reason, it is usually better to use the `pct` command to
662generate and modify those files, or do the whole thing using the GUI.
663Our toolkit is smart enough to instantaneously apply most changes to
664running containers. This feature is called "hot plug", and there is no
665need to restart the container in that case.
666
667
668File Format
669~~~~~~~~~~~
670
671Container configuration files use a simple colon separated key/value
672format. Each line has the following format:
673
674-----
675# this is a comment
676OPTION: value
677-----
678
679Blank lines in those files are ignored, and lines starting with a `#`
680character are treated as comments and are also ignored.
681
682It is possible to add low-level, LXC style configuration directly, for
683example:
684
685 lxc.init_cmd: /sbin/my_own_init
686
687or
688
689 lxc.init_cmd = /sbin/my_own_init
690
691Those settings are directly passed to the LXC low-level tools.
692
693
694[[pct_snapshots]]
695Snapshots
696~~~~~~~~~
697
698When you create a snapshot, `pct` stores the configuration at snapshot
699time into a separate snapshot section within the same configuration
700file. For example, after creating a snapshot called ``testsnapshot'',
701your configuration file will look like this:
702
703.Container configuration with snapshot
704----
705memory: 512
706swap: 512
707parent: testsnaphot
708...
709
710[testsnaphot]
711memory: 512
712swap: 512
713snaptime: 1457170803
714...
715----
716
717There are a few snapshot related properties like `parent` and
718`snaptime`. The `parent` property is used to store the parent/child
719relationship between snapshots. `snaptime` is the snapshot creation
720time stamp (Unix epoch).
721
722
723[[pct_options]]
724Options
725~~~~~~~
726
727include::pct.conf.5-opts.adoc[]
728
729
2a11aa70
DM
730Locks
731-----
732
733Container migrations, snapshots and backups (`vzdump`) set a lock to
734prevent incompatible concurrent actions on the affected container. Sometimes
735you need to remove such a lock manually (e.g., after a power failure).
736
737 pct unlock <CTID>
738
739CAUTION: Only do that if you are sure the action which set the lock is
740no longer running.
741
fe57a420 742
0c6b782f 743ifdef::manvolnum[]
3bd9d0cf
DM
744
745Files
746------
747
748`/etc/pve/lxc/<CTID>.conf`::
749
750Configuration file for the container '<CTID>'.
751
752
0c6b782f
DM
753include::pve-copyright.adoc[]
754endif::manvolnum[]
755
756
757
758
759
760
761