User Tools

Site Tools


proxmox:introduction_to_linux_container_lxc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
proxmox:introduction_to_linux_container_lxc [2015/11/18 13:44]
cbustillo [Get a container template]
proxmox:introduction_to_linux_container_lxc [2015/11/18 13:51] (current)
cbustillo [Get a container template]
Line 51: Line 51:
  
 <​code>​ <​code>​
-pveam update+pveam update
 </​code>​ </​code>​
 +
 +===== Create container =====
 +
 +After you have downloaded a template, you can create a container based on it. 
 +
 +A GUI wizard will guide you through the creation process. ​
 +
 +It is also possible to create a container with the pct command line tool. More details see manpages.
 +
 +<​code>​
 +pct create 104 /​var/​lib/​vz/​template/​cache/​debian-8.0-standard_8.0-1_amd64.tar.gz \
 + ​-description LXC -rootfs 4 -hostname pvecontainer01 -memory 1024 -nameserver 8.8.8.8 \
 + -net0 name=eth0,​hwaddr=52:​4A:​5E:​26:​58:​D8,​ip=192.168.15.147/​24,​gw=192.168.15.1,​bridge=vmbr0 \
 + ​-storage local -password changeme
 +</​code>​
 +
 +===== Start container =====
 +
 +There are two possibilities to start a container:
 +
 +either on the GUI or on the command line:
 +
 +<​code>​
 +pct start 100
 +</​code>​
 +
 +
 +===== Stop container =====
 +
 +Stopping a container can be done in a similar way like starting a container. ​
 +
 +<​code>​
 +pct stop 100
 +</​code>​
 +
 +===== Backup container =====
 +
 +The backup can be done in three different modes: snapshot, suspend and stopped. This mode options have only an effect if the container is running.
 +
 +Snapshot mode: this feature depends on the filesystem and so it must support snapshots. If snapshot mode is chosen but it's not supported by the filesystem the backup will be done in suspend mode.
 +
 +Suspend mode: the container will be frozen during the time the backup is running. NOTE: Container is not running untill backup is done!
 +
 +Stopped mode: the container will be turned off and restarted after backup.
 +
 +The command line tool backing up Linux container is vzdump. For more information read vzdump manpage.
 +
 +<​code>​
 +vzdump 100 -compress lzo -dumpdir /​var/​lib/​vz/​dump/​ -mode snapshot -remove 0
 +</​code>​
 +
 +===== Restore container =====
 +
 +It is easy and fast to restore a container.
 +
 +On the GUI it was only possible to restore a container with the same VMID and if there is no VM with this VMID. In Proxmox VE 3+ it can be restored to any available VMID.
 +
 +If you need to change the VMID or override a VM you can use the command line tool pct.
 +
 +For more information read the man page of pct. 
 +
 +<​code>​
 +pct restore 101 /​var/​lib/​vz/​dump/​vzdump-lxc-100-2015_06_22-11_12_40.tar.lzo
 +</​code>​
 +
 +===== Migrate container from OpenVZ to Linux container =====
 +
 +Follow this howto:
 +
 +  * [[|Convert OpenVZ to LXC]]
 ====== Resources ====== ====== Resources ======
  
proxmox/introduction_to_linux_container_lxc.txt ยท Last modified: 2015/11/18 13:51 by cbustillo